<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.2/css/all.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css">

<script class="hexo-configurations">
    var NexT = window.NexT || {};
    var CONFIG = {"hostname":"littlefxc.github.io","root":"/","images":"/images","scheme":"Mist","version":"8.2.2","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}};
  </script>
<meta name="description" content="1.项目结构 2.Maven12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061&lt;?xml version&#x3D;&quot;1.0&quot; encoding&#x3D;&quot;UTF-8&quot;?&gt;  &lt;pro">
<meta property="og:type" content="article">
<meta property="og:title" content="spring-boot-starter-quartz动态调度任务实现">
<meta property="og:url" content="http://littlefxc.github.io/2019/05/06/spring-boot-starter-quartz%E5%8A%A8%E6%80%81%E8%B0%83%E5%BA%A6%E4%BB%BB%E5%8A%A1%E5%AE%9E%E7%8E%B0/index.html">
<meta property="og:site_name" content="一年春又来">
<meta property="og:description" content="1.项目结构 2.Maven12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061&lt;?xml version&#x3D;&quot;1.0&quot; encoding&#x3D;&quot;UTF-8&quot;?&gt;  &lt;pro">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://img-blog.csdnimg.cn/20181225160450315.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0xpdHRsZV9meGM=,size_16,color_FFFFFF,t_70">
<meta property="article:published_time" content="2019-05-06T11:56:52.000Z">
<meta property="article:modified_time" content="2021-03-25T13:15:49.030Z">
<meta property="article:author" content="一年春又来">
<meta property="article:tag" content="spring-boot">
<meta property="article:tag" content="定时调度器">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://img-blog.csdnimg.cn/20181225160450315.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0xpdHRsZV9meGM=,size_16,color_FFFFFF,t_70">


<link rel="canonical" href="http://littlefxc.github.io/2019/05/06/spring-boot-starter-quartz%E5%8A%A8%E6%80%81%E8%B0%83%E5%BA%A6%E4%BB%BB%E5%8A%A1%E5%AE%9E%E7%8E%B0/">


<script class="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome : false,
    isPost : true,
    lang   : 'zh-CN'
  };
</script>
<title>spring-boot-starter-quartz动态调度任务实现 | 一年春又来</title>
  




  <noscript>
  <style>
  body { margin-top: 2rem; }

  .use-motion .menu-item,
  .use-motion .sidebar,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header {
    visibility: visible;
  }

  .use-motion .header,
  .use-motion .site-brand-container .toggle,
  .use-motion .footer { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle,
  .use-motion .custom-logo-image {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line {
    transform: scaleX(1);
  }

  .search-pop-overlay, .sidebar-nav { display: none; }
  .sidebar-panel { display: block; }
  </style>
</noscript>

<link rel="alternate" href="/atom.xml" title="一年春又来" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">一年春又来</h1>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu">
        <li class="menu-item menu-item-home"><a href="/" rel="section"><i class="home                          //首页 fa-fw"></i>首页</a></li>
        <li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="archive          //归档 fa-fw"></i>归档</a></li>
        <li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="th           //分类 fa-fw"></i>分类</a></li>
        <li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="tags                     //标签 fa-fw"></i>标签</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#1-%E9%A1%B9%E7%9B%AE%E7%BB%93%E6%9E%84"><span class="nav-text">1.项目结构</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#2-Maven"><span class="nav-text">2.Maven</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#3-%E6%95%B0%E6%8D%AE%E5%BA%93-%E6%A8%A1%E5%9E%8B"><span class="nav-text">3.数据库-模型</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#3-1-scheduler-job-info-sql"><span class="nav-text">3.1. scheduler_job_info.sql</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-2-%E5%AE%9E%E4%BD%93%E7%B1%BB"><span class="nav-text">3.2.实体类</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#4-%E9%85%8D%E7%BD%AE"><span class="nav-text">4.配置</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#4-1-application-properties"><span class="nav-text">4.1.application.properties</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#4-2-%E8%87%AA%E5%AE%9A%E4%B9%89SchedulerFactoryBean"><span class="nav-text">4.2.自定义SchedulerFactoryBean</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#5-%E7%BB%84%E4%BB%B6"><span class="nav-text">5.组件</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#5-1-CustomQuartzInstanceIdGenerator"><span class="nav-text">5.1.CustomQuartzInstanceIdGenerator</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-2-SchedulerJobFactory"><span class="nav-text">5.2.SchedulerJobFactory</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#5-3-JobScheduleCreator"><span class="nav-text">5.3.JobScheduleCreator</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#6-Jobs"><span class="nav-text">6.Jobs</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#Simple-Job"><span class="nav-text">Simple Job</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Cron-Job"><span class="nav-text">Cron Job</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#7-%E6%8E%A7%E5%88%B6%E5%99%A8%E5%B1%82"><span class="nav-text">7.控制器层</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#7-1-QuartzController"><span class="nav-text">7.1.QuartzController</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#7-2-SchedulerController"><span class="nav-text">7.2.SchedulerController</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#8-Service%E5%B1%82"><span class="nav-text">8.Service层</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#8-1-SchedulerServiceImpl"><span class="nav-text">8.1.SchedulerServiceImpl</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#9-Dao%E5%B1%82"><span class="nav-text">9.Dao层</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#9-1-SchedulerRepository"><span class="nav-text">9.1.SchedulerRepository</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#10-%E7%BD%91%E9%A1%B5Vue-ElementUI%E5%AE%9E%E7%8E%B0"><span class="nav-text">10.网页Vue+ElementUI实现</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#10-1-simple-html"><span class="nav-text">10.1.simple.html</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#10-2-cron-html"><span class="nav-text">10.2.cron.html</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#11-%E5%BC%95%E7%94%A8"><span class="nav-text">11. 引用</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">一年春又来</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">234</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">38</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">125</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://littlefxc.github.io/2019/05/06/spring-boot-starter-quartz%E5%8A%A8%E6%80%81%E8%B0%83%E5%BA%A6%E4%BB%BB%E5%8A%A1%E5%AE%9E%E7%8E%B0/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="一年春又来">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="一年春又来">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          spring-boot-starter-quartz动态调度任务实现
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2019-05-06 19:56:52" itemprop="dateCreated datePublished" datetime="2019-05-06T19:56:52+08:00">2019-05-06</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">更新于</span>
        <time title="修改时间：2021-03-25 21:15:49" itemprop="dateModified" datetime="2021-03-25T21:15:49+08:00">2021-03-25</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/Java/" itemprop="url" rel="index"><span itemprop="name">Java</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h1 id="1-项目结构"><a href="#1-项目结构" class="headerlink" title="1.项目结构"></a>1.项目结构</h1><p><img src="https://img-blog.csdnimg.cn/20181225160450315.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0xpdHRsZV9meGM=,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"></p>
<h1 id="2-Maven"><a href="#2-Maven" class="headerlink" title="2.Maven"></a>2.Maven</h1><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">project</span> <span class="attr">xmlns</span>=<span class="string">&quot;http://maven.apache.org/POM/4.0.0&quot;</span>  </span></span><br><span class="line"><span class="tag">         <span class="attr">xmlns:xsi</span>=<span class="string">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span>  </span></span><br><span class="line"><span class="tag">         <span class="attr">xsi:schemaLocation</span>=<span class="string">&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">modelVersion</span>&gt;</span>4.0.0<span class="tag">&lt;/<span class="name">modelVersion</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>com.littlefxc<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>learn-quartz-SpringBoot<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">version</span>&gt;</span>1.0-snapshot<span class="tag">&lt;/<span class="name">version</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">properties</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">project.build.sourceEncoding</span>&gt;</span>UTF-8<span class="tag">&lt;/<span class="name">project.build.sourceEncoding</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">project.reporting.outputEncoding</span>&gt;</span>UTF-8<span class="tag">&lt;/<span class="name">project.reporting.outputEncoding</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">java.version</span>&gt;</span>1.8<span class="tag">&lt;/<span class="name">java.version</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">properties</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">parent</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.boot<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-boot-starter-parent<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">version</span>&gt;</span>2.0.4.RELEASE<span class="tag">&lt;/<span class="name">version</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">parent</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">dependencies</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.projectlombok<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>lombok<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.boot<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-boot-starter-web<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.boot<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-boot-starter-quartz<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.boot<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-boot-starter-data-jpa<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>org.springframework.boot<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>spring-boot-starter-test<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">scope</span>&gt;</span>test<span class="tag">&lt;/<span class="name">scope</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>com.alibaba<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>druid-spring-boot-starter<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">version</span>&gt;</span>1.1.10<span class="tag">&lt;/<span class="name">version</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>mysql<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>mysql-connector-java<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">groupId</span>&gt;</span>javax.servlet<span class="tag">&lt;/<span class="name">groupId</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">artifactId</span>&gt;</span>javax.servlet-api<span class="tag">&lt;/<span class="name">artifactId</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">version</span>&gt;</span>3.1.0<span class="tag">&lt;/<span class="name">version</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">scope</span>&gt;</span>provided<span class="tag">&lt;/<span class="name">scope</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">dependency</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">dependencies</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;/<span class="name">project</span>&gt;</span>  </span><br></pre></td></tr></table></figure>

<h1 id="3-数据库-模型"><a href="#3-数据库-模型" class="headerlink" title="3.数据库-模型"></a>3.数据库-模型</h1><p>在jar包quartz-2.3.0.jar下有数据库sql文件.</p>
<p>sql文件的包路径地址：<code>org.quartz.impl.jdbcjobstore</code>，选择<code>tables_mysql_innodb.sql</code></p>
<h2 id="3-1-scheduler-job-info-sql"><a href="#3-1-scheduler-job-info-sql" class="headerlink" title="3.1. scheduler_job_info.sql"></a>3.1. scheduler_job_info.sql</h2><figure class="highlight sql"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">DROP</span> <span class="keyword">TABLE</span> IF <span class="keyword">EXISTS</span> `scheduler_job_info`;  </span><br><span class="line"><span class="keyword">CREATE</span> <span class="keyword">TABLE</span> `scheduler_job_info`  (  </span><br><span class="line">  `id` <span class="type">bigint</span>(<span class="number">20</span>) <span class="keyword">NOT</span> <span class="keyword">NULL</span> AUTO_INCREMENT,  </span><br><span class="line">  `cron_expression` <span class="type">varchar</span>(<span class="number">255</span>) <span class="type">CHARACTER</span> <span class="keyword">SET</span> utf8 <span class="keyword">COLLATE</span> utf8_general_ci <span class="keyword">NULL</span> <span class="keyword">DEFAULT</span> <span class="keyword">NULL</span>,  </span><br><span class="line">  `cron_job` bit(<span class="number">1</span>) <span class="keyword">NULL</span> <span class="keyword">DEFAULT</span> <span class="keyword">NULL</span>,  </span><br><span class="line">  `job_class` <span class="type">varchar</span>(<span class="number">255</span>) <span class="type">CHARACTER</span> <span class="keyword">SET</span> utf8 <span class="keyword">COLLATE</span> utf8_general_ci <span class="keyword">NULL</span> <span class="keyword">DEFAULT</span> <span class="keyword">NULL</span>,  </span><br><span class="line">  `job_group` <span class="type">varchar</span>(<span class="number">255</span>) <span class="type">CHARACTER</span> <span class="keyword">SET</span> utf8 <span class="keyword">COLLATE</span> utf8_general_ci <span class="keyword">NULL</span> <span class="keyword">DEFAULT</span> <span class="keyword">NULL</span>,  </span><br><span class="line">  `job_name` <span class="type">varchar</span>(<span class="number">255</span>) <span class="type">CHARACTER</span> <span class="keyword">SET</span> utf8 <span class="keyword">COLLATE</span> utf8_general_ci <span class="keyword">NOT</span> <span class="keyword">NULL</span>,  </span><br><span class="line">  `scheduler_name` <span class="type">varchar</span>(<span class="number">50</span>) <span class="type">CHARACTER</span> <span class="keyword">SET</span> utf8 <span class="keyword">COLLATE</span> utf8_general_ci <span class="keyword">NOT</span> <span class="keyword">NULL</span>,  </span><br><span class="line">  `repeat_time` <span class="type">bigint</span>(<span class="number">20</span>) <span class="keyword">NULL</span> <span class="keyword">DEFAULT</span> <span class="keyword">NULL</span>,  </span><br><span class="line">  <span class="keyword">PRIMARY</span> KEY (`id`) <span class="keyword">USING</span> BTREE,  </span><br><span class="line">  <span class="keyword">UNIQUE</span> INDEX `uk_job_name`(`job_name`) <span class="keyword">USING</span> BTREE  </span><br><span class="line">) ENGINE <span class="operator">=</span> InnoDB AUTO_INCREMENT <span class="operator">=</span> <span class="number">4</span> <span class="type">CHARACTER</span> <span class="keyword">SET</span> <span class="operator">=</span> utf8 <span class="keyword">COLLATE</span> <span class="operator">=</span> utf8_general_ci ROW_FORMAT <span class="operator">=</span> <span class="keyword">Dynamic</span>;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">SET</span> FOREIGN_KEY_CHECKS <span class="operator">=</span> <span class="number">1</span>;  </span><br></pre></td></tr></table></figure>

<h2 id="3-2-实体类"><a href="#3-2-实体类" class="headerlink" title="3.2.实体类"></a>3.2.实体类</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.littlefxc.example.quartz.enitiy;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> lombok.Data;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> javax.persistence.*;  </span><br><span class="line"><span class="keyword">import</span> java.io.Serializable;  </span><br><span class="line">  </span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> fengxuechao</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@date</span> 12/19/2018</span></span><br><span class="line"><span class="comment"> */</span>  </span><br><span class="line"><span class="meta">@Data</span>  </span><br><span class="line"><span class="meta">@Entity</span>  </span><br><span class="line"><span class="meta">@Table(name = &quot;scheduler_job_info&quot;)</span>  </span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">SchedulerJob</span> <span class="keyword">implements</span> <span class="title">Serializable</span> </span>&#123;  </span><br><span class="line">  </span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">static</span> <span class="keyword">final</span> <span class="keyword">long</span> serialVersionUID = -<span class="number">8990533448070839127L</span>;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Id</span>  </span><br><span class="line">    <span class="meta">@GeneratedValue(strategy = GenerationType.IDENTITY)</span>  </span><br><span class="line">    <span class="keyword">private</span> Long id;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Column(unique = true)</span>  </span><br><span class="line">    <span class="keyword">private</span> String jobName;  </span><br><span class="line">  </span><br><span class="line">    <span class="keyword">private</span> String jobGroup;  </span><br><span class="line">  </span><br><span class="line">    <span class="keyword">private</span> String jobClass;  </span><br><span class="line">  </span><br><span class="line">    <span class="keyword">private</span> String cronExpression;  </span><br><span class="line">  </span><br><span class="line">    <span class="keyword">private</span> Long repeatTime;  </span><br><span class="line">  </span><br><span class="line">    <span class="keyword">private</span> Boolean cronJob;  </span><br><span class="line">  </span><br><span class="line">    <span class="keyword">private</span> String schedulerName;  </span><br><span class="line">&#125;  </span><br></pre></td></tr></table></figure>

<h1 id="4-配置"><a href="#4-配置" class="headerlink" title="4.配置"></a>4.配置</h1><h2 id="4-1-application-properties"><a href="#4-1-application-properties" class="headerlink" title="4.1.application.properties"></a>4.1.application.properties</h2><p><code>com.littlefxc.example.quartz.component.CustomQuartzInstanceIdGenerator</code>表示使用自定义的实例名生成策略，该类代码可以在5.1章节中看到,在数据库上的代码实际效果可以查看到(表<code>qrtz_scheduler_state</code>, 字段<code>INSTANCE_NAME</code>)。</p>
<figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">spring.application.name</span>=<span class="string">learn-quartz-SpringBoot  </span></span><br><span class="line">  </span><br><span class="line"><span class="comment"># jackson Config  </span></span><br><span class="line"><span class="meta">spring.jackson.time-zone</span>=<span class="string">GMT+8  </span></span><br><span class="line"><span class="meta">spring.jackson.date-format</span>=<span class="string">yyyy-MM-dd HH:mm:sss  </span></span><br><span class="line"><span class="comment">#spring.jackson.property-naming-strategy=SNAKE_CASE  </span></span><br><span class="line">  </span><br><span class="line"><span class="comment"># DataSource Config  </span></span><br><span class="line"><span class="meta">spring.datasource.url</span>=<span class="string">jdbc:mysql://localhost:3306/learn-quartz?useSSL=false  </span></span><br><span class="line"><span class="meta">spring.datasource.username</span>=<span class="string">root  </span></span><br><span class="line"><span class="meta">spring.datasource.password</span>=<span class="string">123456  </span></span><br><span class="line"><span class="meta">spring.datasource.driver-class-name</span>=<span class="string">com.mysql.jdbc.Driver  </span></span><br><span class="line"><span class="meta">spring.datasource.type</span>=<span class="string">com.alibaba.druid.pool.DruidDataSource  </span></span><br><span class="line"><span class="meta">spring.datasource.druid.filters</span>=<span class="string">slf4j,wall  </span></span><br><span class="line"><span class="meta">spring.datasource.druid.initial-size</span>=<span class="string">1  </span></span><br><span class="line"><span class="meta">spring.datasource.druid.min-idle</span>=<span class="string">1  </span></span><br><span class="line"><span class="meta">spring.datasource.druid.max-active</span>=<span class="string">8  </span></span><br><span class="line"><span class="meta">spring.datasource.druid.max-wait</span>=<span class="string">60000  </span></span><br><span class="line"><span class="meta">spring.datasource.druid.time-between-eviction-runs-millis</span>=<span class="string">60000  </span></span><br><span class="line"><span class="meta">spring.datasource.druid.min-evictable-idle-time-millis</span>=<span class="string">300000  </span></span><br><span class="line"><span class="meta">spring.datasource.druid.test-while-idle</span>=<span class="string">true  </span></span><br><span class="line"><span class="meta">spring.datasource.druid.test-on-borrow</span>=<span class="string">false  </span></span><br><span class="line"><span class="meta">spring.datasource.druid.test-on-return</span>=<span class="string">false  </span></span><br><span class="line"><span class="meta">spring.datasource.druid.pool-prepared-statements</span>=<span class="string">true  </span></span><br><span class="line"><span class="meta">spring.datasource.druid.max-pool-prepared-statement-per-connection-size</span>=<span class="string">20  </span></span><br><span class="line">  </span><br><span class="line"><span class="comment"># JPA Config  </span></span><br><span class="line"><span class="meta">spring.jpa.hibernate.ddl-auto</span>=<span class="string">update  </span></span><br><span class="line"><span class="comment">#spring.jpa.open-in-view=false  </span></span><br><span class="line"><span class="meta">spring.jpa.show-sql</span>=<span class="string">true  </span></span><br><span class="line">  </span><br><span class="line"><span class="comment"># Quartz Config  </span></span><br><span class="line"><span class="meta">spring.quartz.job-store-type</span>=<span class="string">jdbc  </span></span><br><span class="line"><span class="meta">spring.quartz.jdbc.initialize-schema</span>=<span class="string">never  </span></span><br><span class="line">  </span><br><span class="line"><span class="meta">spring.quartz.properties.org.quartz.scheduler.instanceName</span>=<span class="string">$&#123;spring.application.name&#125;  </span></span><br><span class="line"><span class="meta">spring.quartz.properties.org.quartz.scheduler.instanceId</span>=<span class="string">AUTO  </span></span><br><span class="line"><span class="meta">spring.quartz.properties.org.quartz.scheduler.instanceIdGenerator.class</span>=<span class="string">com.littlefxc.example.quartz.component.CustomQuartzInstanceIdGenerator  </span></span><br><span class="line"><span class="meta">spring.quartz.properties.org.quartz.threadPool.threadCount</span>=<span class="string">20  </span></span><br><span class="line"><span class="meta">spring.quartz.properties.org.quartz.jobStore.class</span>=<span class="string">org.quartz.impl.jdbcjobstore.JobStoreTX  </span></span><br><span class="line"><span class="meta">spring.quartz.properties.org.quartz.jobStore.driverDelegateClass</span>=<span class="string">org.quartz.impl.jdbcjobstore.StdJDBCDelegate  </span></span><br><span class="line"><span class="meta">spring.quartz.properties.org.quartz.jobStore.useProperties</span>=<span class="string">true  </span></span><br><span class="line"><span class="meta">spring.quartz.properties.org.quartz.jobStore.misfireThreshold</span>=<span class="string">60000  </span></span><br><span class="line"><span class="meta">spring.quartz.properties.org.quartz.jobStore.tablePrefix</span>=<span class="string">qrtz_  </span></span><br><span class="line"><span class="meta">spring.quartz.properties.org.quartz.jobStore.isClustered</span>=<span class="string">true  </span></span><br><span class="line"><span class="meta">spring.quartz.properties.org.quartz.plugin.shutdownHook.class</span>=<span class="string">org.quartz.plugins.management.ShutdownHookPlugin  </span></span><br><span class="line"><span class="meta">spring.quartz.properties.org.quartz.plugin.shutdownHook.cleanShutdown</span>=<span class="string">TRUE  </span></span><br></pre></td></tr></table></figure>

<h2 id="4-2-自定义SchedulerFactoryBean"><a href="#4-2-自定义SchedulerFactoryBean" class="headerlink" title="4.2.自定义SchedulerFactoryBean"></a>4.2.自定义SchedulerFactoryBean</h2><p>创建SchedulerFactoryBean。<br>黄色代码高亮处表示在SchedulerFactoryBean中注入Spring上下文(applicationContext)，该类(SchedulerJobFactory)可以在5.2章节中详细查看</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.littlefxc.example.quartz.config;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> com.littlefxc.example.quartz.component.SchedulerJobFactory;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.factory.annotation.Autowired;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.boot.autoconfigure.quartz.QuartzProperties;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.context.ApplicationContext;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.context.annotation.Bean;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.context.annotation.Configuration;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.scheduling.quartz.SchedulerFactoryBean;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> javax.sql.DataSource;  </span><br><span class="line"><span class="keyword">import</span> java.util.Properties;  </span><br><span class="line">  </span><br><span class="line"><span class="comment">/** </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> fengxuechao </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@date</span> 12/19/2018 </span></span><br><span class="line"><span class="comment"> */</span>  </span><br><span class="line"><span class="meta">@Configuration</span>  </span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">SchedulerConfig</span> </span>&#123;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Autowired</span>  </span><br><span class="line">    <span class="keyword">private</span> DataSource dataSource;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Autowired</span>  </span><br><span class="line">    <span class="keyword">private</span> ApplicationContext applicationContext;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Autowired</span>  </span><br><span class="line">    <span class="keyword">private</span> QuartzProperties quartzProperties;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * create scheduler factory </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@Bean</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> SchedulerFactoryBean <span class="title">schedulerFactoryBean</span><span class="params">()</span> </span>&#123;  </span><br><span class="line">  </span><br><span class="line">        SchedulerJobFactory jobFactory = <span class="keyword">new</span> SchedulerJobFactory();  </span><br><span class="line">        jobFactory.setApplicationContext(applicationContext);  </span><br><span class="line">  </span><br><span class="line">        Properties properties = <span class="keyword">new</span> Properties();  </span><br><span class="line">        properties.putAll(quartzProperties.getProperties());  </span><br><span class="line">  </span><br><span class="line">        SchedulerFactoryBean factory = <span class="keyword">new</span> SchedulerFactoryBean();  </span><br><span class="line">        factory.setOverwriteExistingJobs(<span class="keyword">true</span>);  </span><br><span class="line">        factory.setDataSource(dataSource);  </span><br><span class="line">        factory.setQuartzProperties(properties);  </span><br><span class="line">        factory.setJobFactory(jobFactory);  </span><br><span class="line">        <span class="keyword">return</span> factory;  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">&#125;  </span><br></pre></td></tr></table></figure>

<h1 id="5-组件"><a href="#5-组件" class="headerlink" title="5.组件"></a>5.组件</h1><h2 id="5-1-CustomQuartzInstanceIdGenerator"><a href="#5-1-CustomQuartzInstanceIdGenerator" class="headerlink" title="5.1.CustomQuartzInstanceIdGenerator"></a>5.1.CustomQuartzInstanceIdGenerator</h2><p>用法详见4.1章节</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.littlefxc.example.quartz.component;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> org.quartz.SchedulerException;  </span><br><span class="line"><span class="keyword">import</span> org.quartz.spi.InstanceIdGenerator;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> java.util.UUID;  </span><br><span class="line">  </span><br><span class="line"><span class="comment">/** </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> fengxuechao </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@date</span> 12/19/2018 </span></span><br><span class="line"><span class="comment"> */</span>  </span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">CustomQuartzInstanceIdGenerator</span> <span class="keyword">implements</span> <span class="title">InstanceIdGenerator</span> </span>&#123;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">generateInstanceId</span><span class="params">()</span> <span class="keyword">throws</span> SchedulerException </span>&#123;  </span><br><span class="line">        <span class="keyword">try</span> &#123;  </span><br><span class="line">            <span class="keyword">return</span> UUID.randomUUID().toString();  </span><br><span class="line">        &#125; <span class="keyword">catch</span> (Exception ex) &#123;  </span><br><span class="line">            <span class="keyword">throw</span> <span class="keyword">new</span> SchedulerException(<span class="string">&quot;Couldn&#x27;t generate UUID!&quot;</span>, ex);  </span><br><span class="line">        &#125;  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<h2 id="5-2-SchedulerJobFactory"><a href="#5-2-SchedulerJobFactory" class="headerlink" title="5.2.SchedulerJobFactory"></a>5.2.SchedulerJobFactory</h2><p>Quartz与Spring结合。<br>在SchedulerFactory中引入Spring上下文。<br>用法详见4.2章节。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.littlefxc.example.quartz.component;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> org.quartz.spi.TriggerFiredBundle;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.factory.config.AutowireCapableBeanFactory;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.context.ApplicationContext;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.context.ApplicationContextAware;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.scheduling.quartz.SpringBeanJobFactory;  </span><br><span class="line">  </span><br><span class="line"><span class="comment">/** </span></span><br><span class="line"><span class="comment"> * 模仿了：&#123;<span class="doctag">@link</span> org.springframework.boot.autoconfigure.quartz.AutowireCapableBeanJobFactory&#125; </span></span><br><span class="line"><span class="comment"> * </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> fengxuechao </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@date</span> 12/19/2018 </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@see</span> &lt;a href=&quot;http://blog.btmatthews.com/?p=40#comment-33797&quot;&gt;注入Spring上下文(applicationContext) </span></span><br><span class="line"><span class="comment"> */</span>  </span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">SchedulerJobFactory</span> <span class="keyword">extends</span> <span class="title">SpringBeanJobFactory</span> <span class="keyword">implements</span> <span class="title">ApplicationContextAware</span> </span>&#123;  </span><br><span class="line">  </span><br><span class="line">    <span class="keyword">private</span> AutowireCapableBeanFactory beanFactory;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setApplicationContext</span><span class="params">(<span class="keyword">final</span> ApplicationContext context)</span> </span>&#123;  </span><br><span class="line">        beanFactory = context.getAutowireCapableBeanFactory();  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">protected</span> Object <span class="title">createJobInstance</span><span class="params">(<span class="keyword">final</span> TriggerFiredBundle bundle)</span> <span class="keyword">throws</span> Exception </span>&#123;  </span><br><span class="line">        <span class="keyword">final</span> Object job = <span class="keyword">super</span>.createJobInstance(bundle);  </span><br><span class="line">        beanFactory.autowireBean(job);  </span><br><span class="line">        <span class="keyword">return</span> job;  </span><br><span class="line">    &#125;  </span><br><span class="line">&#125;  </span><br></pre></td></tr></table></figure>

<h2 id="5-3-JobScheduleCreator"><a href="#5-3-JobScheduleCreator" class="headerlink" title="5.3.JobScheduleCreator"></a>5.3.JobScheduleCreator</h2><p>Scheduler 创建Job，SimpleTrigger，CronTrigger的封装类。<br>用法在service 层体现。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.littlefxc.example.quartz.component;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> lombok.extern.slf4j.Slf4j;  </span><br><span class="line"><span class="keyword">import</span> org.quartz.CronTrigger;  </span><br><span class="line"><span class="keyword">import</span> org.quartz.JobDataMap;  </span><br><span class="line"><span class="keyword">import</span> org.quartz.JobDetail;  </span><br><span class="line"><span class="keyword">import</span> org.quartz.SimpleTrigger;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.context.ApplicationContext;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.scheduling.quartz.CronTriggerFactoryBean;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.scheduling.quartz.JobDetailFactoryBean;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.scheduling.quartz.QuartzJobBean;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.scheduling.quartz.SimpleTriggerFactoryBean;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Component;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> java.text.ParseException;  </span><br><span class="line"><span class="keyword">import</span> java.util.Date;  </span><br><span class="line">  </span><br><span class="line"><span class="comment">/** </span></span><br><span class="line"><span class="comment"> * Scheduler创建Job, SimpleTrigger, CronTrigger </span></span><br><span class="line"><span class="comment"> * </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> fengxuechao </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@date</span> 12/19/2018 </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@see</span> &lt;a href=&quot;https://blog.csdn.net/yangshangwei/article/details/78539433#withmisfirehandlinginstructiondonothing&quot;&gt;Quartz-错过触发机制&lt;/a&gt; </span></span><br><span class="line"><span class="comment"> */</span>  </span><br><span class="line"><span class="meta">@Slf4j</span>  </span><br><span class="line"><span class="meta">@Component</span>  </span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">JobScheduleCreator</span> </span>&#123;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * Create Quartz Job. </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobClass  Class whose executeInternal() method needs to be called. </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> isDurable Job needs to be persisted even after completion. if true, job will be persisted, not otherwise. </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> context   Spring application context. </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobName   Job name. </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobGroup  Job group. </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> JobDetail object </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> JobDetail <span class="title">createJob</span><span class="params">(Class&lt;? extends QuartzJobBean&gt; jobClass, <span class="keyword">boolean</span> isDurable,  </span></span></span><br><span class="line"><span class="function"><span class="params">                               ApplicationContext context, String jobName, String jobGroup)</span> </span>&#123;  </span><br><span class="line">        JobDetailFactoryBean factoryBean = <span class="keyword">new</span> JobDetailFactoryBean();  </span><br><span class="line">        factoryBean.setJobClass(jobClass);  </span><br><span class="line">        factoryBean.setDurability(isDurable);  </span><br><span class="line">        factoryBean.setApplicationContext(context);  </span><br><span class="line">        factoryBean.setName(jobName);  </span><br><span class="line">        factoryBean.setGroup(jobGroup);  </span><br><span class="line">  </span><br><span class="line">        <span class="comment">// set job data map  </span></span><br><span class="line">        JobDataMap jobDataMap = <span class="keyword">new</span> JobDataMap();  </span><br><span class="line">        jobDataMap.put(jobName + jobGroup, jobClass.getName());  </span><br><span class="line">        factoryBean.setJobDataMap(jobDataMap);  </span><br><span class="line">  </span><br><span class="line">        factoryBean.afterPropertiesSet();  </span><br><span class="line">  </span><br><span class="line">        <span class="keyword">return</span> factoryBean.getObject();  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * Create cron trigger. </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> triggerName        Trigger name. </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> startTime          Trigger start time. </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> cronExpression     Cron expression. </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> misFireInstruction Misfire instruction (what to do in case of misfire happens). </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> &#123;<span class="doctag">@link</span> CronTrigger&#125; </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> CronTrigger <span class="title">createCronTrigger</span><span class="params">(String triggerName, Date startTime, String cronExpression, <span class="keyword">int</span> misFireInstruction)</span> </span>&#123;  </span><br><span class="line">        CronTriggerFactoryBean factoryBean = <span class="keyword">new</span> CronTriggerFactoryBean();  </span><br><span class="line">        factoryBean.setName(triggerName);  </span><br><span class="line">        factoryBean.setStartTime(startTime);  </span><br><span class="line">        factoryBean.setCronExpression(cronExpression);  </span><br><span class="line">        factoryBean.setMisfireInstruction(misFireInstruction);  </span><br><span class="line">        <span class="keyword">try</span> &#123;  </span><br><span class="line">            factoryBean.afterPropertiesSet();  </span><br><span class="line">        &#125; <span class="keyword">catch</span> (ParseException e) &#123;  </span><br><span class="line">            log.error(e.getMessage(), e);  </span><br><span class="line">        &#125;  </span><br><span class="line">        <span class="keyword">return</span> factoryBean.getObject();  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * Create simple trigger. </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> triggerName        Trigger name. </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> startTime          Trigger start time. </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> repeatTime         Job repeat period mills </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> misFireInstruction Misfire instruction (what to do in case of misfire happens). </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> &#123;<span class="doctag">@link</span> SimpleTrigger&#125; </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> SimpleTrigger <span class="title">createSimpleTrigger</span><span class="params">(String triggerName, Date startTime, Long repeatTime, <span class="keyword">int</span> misFireInstruction)</span> </span>&#123;  </span><br><span class="line">        SimpleTriggerFactoryBean factoryBean = <span class="keyword">new</span> SimpleTriggerFactoryBean();  </span><br><span class="line">        factoryBean.setName(triggerName);  </span><br><span class="line">        factoryBean.setStartTime(startTime);  </span><br><span class="line">        factoryBean.setRepeatInterval(repeatTime);  </span><br><span class="line">        factoryBean.setRepeatCount(SimpleTrigger.REPEAT_INDEFINITELY);  </span><br><span class="line">        factoryBean.setMisfireInstruction(misFireInstruction);  </span><br><span class="line">        factoryBean.afterPropertiesSet();  </span><br><span class="line">        <span class="keyword">return</span> factoryBean.getObject();  </span><br><span class="line">    &#125;  </span><br><span class="line">&#125;  </span><br></pre></td></tr></table></figure>

<h1 id="6-Jobs"><a href="#6-Jobs" class="headerlink" title="6.Jobs"></a>6.Jobs</h1><p>这里的任务都是实现了<code>org.quartz.Job</code>这个接口</p>
<h2 id="Simple-Job"><a href="#Simple-Job" class="headerlink" title="Simple Job"></a>Simple Job</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.littlefxc.example.quartz.jobs;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> lombok.extern.slf4j.Slf4j;  </span><br><span class="line"><span class="keyword">import</span> org.quartz.JobExecutionContext;  </span><br><span class="line"><span class="keyword">import</span> org.quartz.JobExecutionException;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.scheduling.quartz.QuartzJobBean;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> java.util.stream.IntStream;  </span><br><span class="line">  </span><br><span class="line"><span class="comment">/** </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> fengxuechao </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@date</span> 12/19/2018 </span></span><br><span class="line"><span class="comment"> */</span>  </span><br><span class="line"><span class="meta">@Slf4j</span>  </span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">SimpleJob</span> <span class="keyword">extends</span> <span class="title">QuartzJobBean</span> </span>&#123;  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title">executeInternal</span><span class="params">(JobExecutionContext context)</span> <span class="keyword">throws</span> JobExecutionException </span>&#123;  </span><br><span class="line">        log.info(<span class="string">&quot;&#123;&#125; Start................&quot;</span>, context.getJobDetail().getKey());  </span><br><span class="line">        IntStream.range(<span class="number">0</span>, <span class="number">5</span>).forEach(i -&gt; &#123;  </span><br><span class="line">            log.info(<span class="string">&quot;Counting - &#123;&#125;&quot;</span>, i);  </span><br><span class="line">            <span class="keyword">try</span> &#123;  </span><br><span class="line">                Thread.sleep(<span class="number">1000</span>);  </span><br><span class="line">            &#125; <span class="keyword">catch</span> (InterruptedException e) &#123;  </span><br><span class="line">                log.error(e.getMessage(), e);  </span><br><span class="line">            &#125;  </span><br><span class="line">        &#125;);  </span><br><span class="line">        log.info(<span class="string">&quot;&#123;&#125; End................&quot;</span>, context.getJobDetail().getKey());  </span><br><span class="line">    &#125;  </span><br><span class="line">&#125;  </span><br></pre></td></tr></table></figure>

<h2 id="Cron-Job"><a href="#Cron-Job" class="headerlink" title="Cron Job"></a>Cron Job</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.littlefxc.example.quartz.jobs;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> lombok.extern.slf4j.Slf4j;  </span><br><span class="line"><span class="keyword">import</span> org.quartz.DisallowConcurrentExecution;  </span><br><span class="line"><span class="keyword">import</span> org.quartz.JobExecutionContext;  </span><br><span class="line"><span class="keyword">import</span> org.quartz.JobExecutionException;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.scheduling.quartz.QuartzJobBean;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> java.util.stream.IntStream;  </span><br><span class="line">  </span><br><span class="line"><span class="comment">/** </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> fengxuechao </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@date</span> 12/19/2018 </span></span><br><span class="line"><span class="comment"> */</span>  </span><br><span class="line"><span class="meta">@Slf4j</span>  </span><br><span class="line"><span class="meta">@DisallowConcurrentExecution</span> <span class="comment">// 这个注解告诉Quartz，一个给定的Job定义（也就是一个JobDetail实例），不并发运行。  </span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">SampleCronJob</span> <span class="keyword">extends</span> <span class="title">QuartzJobBean</span> </span>&#123;  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">protected</span> <span class="keyword">void</span> <span class="title">executeInternal</span><span class="params">(JobExecutionContext context)</span> <span class="keyword">throws</span> JobExecutionException </span>&#123;  </span><br><span class="line">        log.info(<span class="string">&quot;&#123;&#125; Start................&quot;</span>, context.getJobDetail().getKey());  </span><br><span class="line">        IntStream.range(<span class="number">0</span>, <span class="number">10</span>).forEach(i -&gt; &#123;  </span><br><span class="line">            log.info(<span class="string">&quot;Counting - &#123;&#125;&quot;</span>, i);  </span><br><span class="line">            <span class="keyword">try</span> &#123;  </span><br><span class="line">                Thread.sleep(<span class="number">1000</span>);  </span><br><span class="line">            &#125; <span class="keyword">catch</span> (InterruptedException e) &#123;  </span><br><span class="line">                log.error(e.getMessage(), e);  </span><br><span class="line">            &#125;  </span><br><span class="line">        &#125;);  </span><br><span class="line">        log.info(<span class="string">&quot;&#123;&#125; End................&quot;</span>, context.getJobDetail().getKey());  </span><br><span class="line">    &#125;  </span><br><span class="line">&#125;  </span><br></pre></td></tr></table></figure>

<h1 id="7-控制器层"><a href="#7-控制器层" class="headerlink" title="7.控制器层"></a>7.控制器层</h1><h2 id="7-1-QuartzController"><a href="#7-1-QuartzController" class="headerlink" title="7.1.QuartzController"></a>7.1.QuartzController</h2><p>工作调度的主要代码</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.littlefxc.example.quartz.controller;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> com.littlefxc.example.quartz.enitiy.SchedulerJob;  </span><br><span class="line"><span class="keyword">import</span> com.littlefxc.example.quartz.service.SchedulerService;  </span><br><span class="line"><span class="keyword">import</span> lombok.extern.slf4j.Slf4j;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.factory.annotation.Autowired;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.data.domain.Page;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.data.domain.Pageable;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.data.web.PageableDefault;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.*;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> java.util.Map;  </span><br><span class="line">  </span><br><span class="line"><span class="comment">/** </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> fengxuechao </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@date</span> 12/19/2018 </span></span><br><span class="line"><span class="comment"> **/</span>  </span><br><span class="line"><span class="meta">@RestController</span>  </span><br><span class="line"><span class="meta">@RequestMapping(&quot;/job&quot;)</span>  </span><br><span class="line"><span class="meta">@Slf4j</span>  </span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">QuartzController</span> </span>&#123;  </span><br><span class="line">  </span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">final</span> SchedulerService schedulerService;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Autowired</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">QuartzController</span><span class="params">(SchedulerService schedulerService)</span> </span>&#123;  </span><br><span class="line">        <span class="keyword">this</span>.schedulerService = schedulerService;  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 添加 </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobInfo </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@PostMapping(value = &quot;/addjob&quot;)</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">addjob</span><span class="params">(<span class="meta">@RequestBody</span> SchedulerJob jobInfo)</span> </span>&#123;  </span><br><span class="line">        schedulerService.scheduleNewJob(jobInfo);  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 暂停 </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobName </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobGroup </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@PostMapping(value = &quot;/pausejob&quot;)</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">pausejob</span><span class="params">(  </span></span></span><br><span class="line"><span class="function"><span class="params">            <span class="meta">@RequestParam</span> String jobName, <span class="meta">@RequestParam</span> String jobGroup)</span> </span>&#123;  </span><br><span class="line">        schedulerService.pauseJob(jobName, jobGroup);  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 恢复启动 </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobName </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobGroup </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@PostMapping(value = &quot;/resumejob&quot;)</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">resumejob</span><span class="params">(<span class="meta">@RequestParam</span> String jobName, <span class="meta">@RequestParam</span> String jobGroup)</span> </span>&#123;  </span><br><span class="line">        schedulerService.resumeJob(jobName, jobGroup);  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 更新：移除older trigger,添加new trigger </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobInfo </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@PostMapping(value = &quot;/reschedulejob&quot;)</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">rescheduleJob</span><span class="params">(<span class="meta">@RequestBody</span> SchedulerJob jobInfo)</span> </span>&#123;  </span><br><span class="line">        schedulerService.updateScheduleJob(jobInfo);  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 删除 </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobName </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobGroup </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@PostMapping(value = &quot;/deletejob&quot;)</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">deletejob</span><span class="params">(<span class="meta">@RequestParam</span> String jobName, <span class="meta">@RequestParam</span> String jobGroup)</span> </span>&#123;  </span><br><span class="line">        schedulerService.deleteJob(jobName, jobGroup);  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 查询 </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> pageable </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> cron </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@GetMapping(value = &quot;/queryjob&quot;)</span>  </span><br><span class="line">    <span class="keyword">public</span> Page&lt;Map&lt;String, Object&gt;&gt; queryjob(  </span><br><span class="line">            <span class="meta">@PageableDefault</span> Pageable pageable, <span class="meta">@RequestParam</span> Boolean cron) &#123;  </span><br><span class="line">        <span class="keyword">return</span> schedulerService.findAll(pageable, cron);  </span><br><span class="line">    &#125;  </span><br><span class="line">&#125;  </span><br></pre></td></tr></table></figure>

<h2 id="7-2-SchedulerController"><a href="#7-2-SchedulerController" class="headerlink" title="7.2.SchedulerController"></a>7.2.SchedulerController</h2><p>仅对自定义数据库(scheduler_job_info)操作的控制器。</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.littlefxc.example.quartz.controller;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> com.littlefxc.example.quartz.enitiy.SchedulerJob;  </span><br><span class="line"><span class="keyword">import</span> com.littlefxc.example.quartz.service.SchedulerService;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.factory.annotation.Autowired;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.GetMapping;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestMapping;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RequestParam;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.web.bind.annotation.RestController;  </span><br><span class="line">  </span><br><span class="line"><span class="comment">/** </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> fengxuechao </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@date</span> 12/20/2018 </span></span><br><span class="line"><span class="comment"> **/</span>  </span><br><span class="line"><span class="meta">@RestController</span>  </span><br><span class="line"><span class="meta">@RequestMapping(&quot;/job-info&quot;)</span>  </span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">SchedulerController</span> </span>&#123;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Autowired</span>  </span><br><span class="line">    <span class="keyword">private</span> SchedulerService schedulerService;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 根据jobName查询 </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobName </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> &#123;<span class="doctag">@link</span> SchedulerJob&#125; </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@GetMapping(&quot;/findOne&quot;)</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> SchedulerJob <span class="title">findOne</span><span class="params">(<span class="meta">@RequestParam</span> String jobName)</span> </span>&#123;  </span><br><span class="line">        <span class="keyword">return</span> schedulerService.findOne(jobName);  </span><br><span class="line">    &#125;  </span><br><span class="line">&#125;  </span><br></pre></td></tr></table></figure>

<h1 id="8-Service层"><a href="#8-Service层" class="headerlink" title="8.Service层"></a>8.Service层</h1><h2 id="8-1-SchedulerServiceImpl"><a href="#8-1-SchedulerServiceImpl" class="headerlink" title="8.1.SchedulerServiceImpl"></a>8.1.SchedulerServiceImpl</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.littlefxc.example.quartz.service.impl;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> com.littlefxc.example.quartz.component.JobScheduleCreator;  </span><br><span class="line"><span class="keyword">import</span> com.littlefxc.example.quartz.enitiy.SchedulerJob;  </span><br><span class="line"><span class="keyword">import</span> com.littlefxc.example.quartz.repository.SchedulerRepository;  </span><br><span class="line"><span class="keyword">import</span> com.littlefxc.example.quartz.service.SchedulerService;  </span><br><span class="line"><span class="keyword">import</span> lombok.extern.slf4j.Slf4j;  </span><br><span class="line"><span class="keyword">import</span> org.quartz.*;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.beans.factory.annotation.Autowired;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.context.ApplicationContext;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.data.domain.Page;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.data.domain.Pageable;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.scheduling.quartz.QuartzJobBean;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.scheduling.quartz.SchedulerFactoryBean;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Service;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.transaction.annotation.Transactional;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> java.util.Date;  </span><br><span class="line"><span class="keyword">import</span> java.util.List;  </span><br><span class="line"><span class="keyword">import</span> java.util.Map;  </span><br><span class="line">  </span><br><span class="line"><span class="comment">/** </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> fengxuechao </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@date</span> 12/19/2018 </span></span><br><span class="line"><span class="comment"> */</span>  </span><br><span class="line"><span class="meta">@Slf4j</span>  </span><br><span class="line"><span class="meta">@Transactional(rollbackFor = Exception.class)</span>  </span><br><span class="line"><span class="meta">@Service</span>  </span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">SchedulerServiceImpl</span> <span class="keyword">implements</span> <span class="title">SchedulerService</span> </span>&#123;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Autowired</span>  </span><br><span class="line">    <span class="keyword">private</span> SchedulerFactoryBean schedulerFactoryBean;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Autowired</span>  </span><br><span class="line">    <span class="keyword">private</span> SchedulerRepository schedulerRepository;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Autowired</span>  </span><br><span class="line">    <span class="keyword">private</span> ApplicationContext context;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Autowired</span>  </span><br><span class="line">    <span class="keyword">private</span> JobScheduleCreator scheduleCreator;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 启动所有的在表scheduler_job_info中记录的job </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">startAllSchedulers</span><span class="params">()</span> </span>&#123;  </span><br><span class="line">        List&lt;SchedulerJob&gt; jobInfoList = schedulerRepository.findAll();  </span><br><span class="line">        <span class="keyword">if</span> (jobInfoList != <span class="keyword">null</span>) &#123;  </span><br><span class="line">            Scheduler scheduler = schedulerFactoryBean.getScheduler();  </span><br><span class="line">            jobInfoList.forEach(jobInfo -&gt; &#123;  </span><br><span class="line">                <span class="keyword">try</span> &#123;  </span><br><span class="line">                    JobDetail jobDetail = JobBuilder.newJob((Class&lt;? extends QuartzJobBean&gt;) Class.forName(jobInfo.getJobClass()))  </span><br><span class="line">                            .withIdentity(jobInfo.getJobName(), jobInfo.getJobGroup()).build();  </span><br><span class="line">                    <span class="keyword">if</span> (!scheduler.checkExists(jobDetail.getKey())) &#123;  </span><br><span class="line">                        Trigger trigger;  </span><br><span class="line">                        jobDetail = scheduleCreator.createJob((Class&lt;? extends QuartzJobBean&gt;) Class.forName(jobInfo.getJobClass()),  </span><br><span class="line">                                <span class="keyword">false</span>, context, jobInfo.getJobName(), jobInfo.getJobGroup());  </span><br><span class="line">  </span><br><span class="line">                        <span class="keyword">if</span> (jobInfo.getCronJob() &amp;&amp; CronExpression.isValidExpression(jobInfo.getCronExpression())) &#123;  </span><br><span class="line">                            trigger = scheduleCreator.createCronTrigger(jobInfo.getJobName(), <span class="keyword">new</span> Date(),  </span><br><span class="line">                                    jobInfo.getCronExpression(), CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING);  </span><br><span class="line">                        &#125; <span class="keyword">else</span> &#123;  </span><br><span class="line">                            trigger = scheduleCreator.createSimpleTrigger(jobInfo.getJobName(), <span class="keyword">new</span> Date(),  </span><br><span class="line">                                    jobInfo.getRepeatTime(), SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT);  </span><br><span class="line">                        &#125;  </span><br><span class="line">  </span><br><span class="line">                        scheduler.scheduleJob(jobDetail, trigger);  </span><br><span class="line">  </span><br><span class="line">                    &#125;  </span><br><span class="line">                &#125; <span class="keyword">catch</span> (ClassNotFoundException e) &#123;  </span><br><span class="line">                    log.error(<span class="string">&quot;Class Not Found - &#123;&#125;&quot;</span>, jobInfo.getJobClass(), e);  </span><br><span class="line">                &#125; <span class="keyword">catch</span> (SchedulerException e) &#123;  </span><br><span class="line">                    log.error(e.getMessage(), e);  </span><br><span class="line">                &#125;  </span><br><span class="line">            &#125;);  </span><br><span class="line">        &#125;  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">scheduleNewJob</span><span class="params">(SchedulerJob jobInfo)</span> </span>&#123;  </span><br><span class="line">        <span class="keyword">try</span> &#123;  </span><br><span class="line">            Scheduler scheduler = schedulerFactoryBean.getScheduler();  </span><br><span class="line">  </span><br><span class="line">            JobDetail jobDetail = JobBuilder.newJob((Class&lt;? extends QuartzJobBean&gt;) Class.forName(jobInfo.getJobClass()))  </span><br><span class="line">                    .withIdentity(jobInfo.getJobName(), jobInfo.getJobGroup()).build();  </span><br><span class="line">            <span class="keyword">if</span> (!scheduler.checkExists(jobDetail.getKey())) &#123;  </span><br><span class="line">  </span><br><span class="line">                jobDetail = scheduleCreator.createJob((Class&lt;? extends QuartzJobBean&gt;) Class.forName(jobInfo.getJobClass()),  </span><br><span class="line">                        <span class="keyword">false</span>, context, jobInfo.getJobName(), jobInfo.getJobGroup());  </span><br><span class="line">  </span><br><span class="line">                Trigger trigger;  </span><br><span class="line">                <span class="keyword">if</span> (jobInfo.getCronJob()) &#123;  </span><br><span class="line">                    trigger = scheduleCreator.createCronTrigger(jobInfo.getJobName(), <span class="keyword">new</span> Date(), jobInfo.getCronExpression(),  </span><br><span class="line">                            CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING);  </span><br><span class="line">                &#125; <span class="keyword">else</span> &#123;  </span><br><span class="line">                    trigger = scheduleCreator.createSimpleTrigger(jobInfo.getJobName(), <span class="keyword">new</span> Date(), jobInfo.getRepeatTime(),  </span><br><span class="line">                            SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT);  </span><br><span class="line">                &#125;  </span><br><span class="line">  </span><br><span class="line">                scheduler.scheduleJob(jobDetail, trigger);  </span><br><span class="line">                jobInfo.setSchedulerName(schedulerFactoryBean.getScheduler().getSchedulerName());  </span><br><span class="line">                schedulerRepository.save(jobInfo);  </span><br><span class="line">            &#125; <span class="keyword">else</span> &#123;  </span><br><span class="line">                log.error(<span class="string">&quot;scheduleNewJobRequest.jobAlreadyExist&quot;</span>);  </span><br><span class="line">            &#125;  </span><br><span class="line">        &#125; <span class="keyword">catch</span> (ClassNotFoundException e) &#123;  </span><br><span class="line">            log.error(<span class="string">&quot;Class Not Found - &#123;&#125;&quot;</span>, jobInfo.getJobClass(), e);  </span><br><span class="line">        &#125; <span class="keyword">catch</span> (SchedulerException e) &#123;  </span><br><span class="line">            log.error(e.getMessage(), e);  </span><br><span class="line">        &#125;  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">updateScheduleJob</span><span class="params">(SchedulerJob jobInfo)</span> </span>&#123;  </span><br><span class="line">        Trigger newTrigger;  </span><br><span class="line">        <span class="keyword">if</span> (jobInfo.getCronJob()) &#123;  </span><br><span class="line">            newTrigger = scheduleCreator.createCronTrigger(jobInfo.getJobName(), <span class="keyword">new</span> Date(), jobInfo.getCronExpression(),  </span><br><span class="line">                    CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING);  </span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;  </span><br><span class="line">            newTrigger = scheduleCreator.createSimpleTrigger(jobInfo.getJobName(), <span class="keyword">new</span> Date(), jobInfo.getRepeatTime(),  </span><br><span class="line">                    SimpleTrigger.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT);  </span><br><span class="line">        &#125;  </span><br><span class="line">        <span class="keyword">try</span> &#123;  </span><br><span class="line">            schedulerFactoryBean.getScheduler().rescheduleJob(TriggerKey.triggerKey(jobInfo.getJobName()), newTrigger);  </span><br><span class="line">            jobInfo.setSchedulerName(schedulerFactoryBean.getScheduler().getSchedulerName());  </span><br><span class="line">            schedulerRepository.save(jobInfo);  </span><br><span class="line">        &#125; <span class="keyword">catch</span> (SchedulerException e) &#123;  </span><br><span class="line">            log.error(e.getMessage(), e);  </span><br><span class="line">        &#125;  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * unscheduleJob(TriggerKey triggerKey)只是不再调度触发器，所以，当其他的触发器引用了这个Job，它们不会被改变 </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobName </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">unScheduleJob</span><span class="params">(String jobName)</span> </span>&#123;  </span><br><span class="line">        <span class="keyword">try</span> &#123;  </span><br><span class="line">            <span class="keyword">return</span> schedulerFactoryBean.getScheduler().unscheduleJob(<span class="keyword">new</span> TriggerKey(jobName));  </span><br><span class="line">        &#125; <span class="keyword">catch</span> (SchedulerException e) &#123;  </span><br><span class="line">            log.error(<span class="string">&quot;Failed to un-schedule job - &#123;&#125;&quot;</span>, jobName, e);  </span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">false</span>;  </span><br><span class="line">        &#125;  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * deleteJob(JobKey jobKey):&lt;br&gt; </span></span><br><span class="line"><span class="comment">     * 1.循环遍历所有引用此Job的触发器，以取消它们的调度(to unschedule them)&lt;br&gt; </span></span><br><span class="line"><span class="comment">     * 2.从jobstore中删除Job </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobName  job name </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobGroup job group </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">deleteJob</span><span class="params">(String jobName, String jobGroup)</span> </span>&#123;  </span><br><span class="line">        <span class="keyword">try</span> &#123;  </span><br><span class="line">            <span class="keyword">boolean</span> deleteJob = schedulerFactoryBean.getScheduler().deleteJob(<span class="keyword">new</span> JobKey(jobName, jobGroup));  </span><br><span class="line">            <span class="keyword">if</span> (deleteJob) &#123;  </span><br><span class="line">                SchedulerJob job = schedulerRepository.findSchedulerJobByJobName(jobName);  </span><br><span class="line">                schedulerRepository.delete(job);  </span><br><span class="line">            &#125;  </span><br><span class="line">            <span class="keyword">return</span> deleteJob;  </span><br><span class="line">        &#125; <span class="keyword">catch</span> (SchedulerException e) &#123;  </span><br><span class="line">            log.error(<span class="string">&quot;Failed to delete job - &#123;&#125;&quot;</span>, jobName, e);  </span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">false</span>;  </span><br><span class="line">        &#125;  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 暂停 </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobName  job name </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobGroup job group </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">pauseJob</span><span class="params">(String jobName, String jobGroup)</span> </span>&#123;  </span><br><span class="line">        <span class="keyword">try</span> &#123;  </span><br><span class="line">            schedulerFactoryBean.getScheduler().pauseJob(<span class="keyword">new</span> JobKey(jobName, jobGroup));  </span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">true</span>;  </span><br><span class="line">        &#125; <span class="keyword">catch</span> (SchedulerException e) &#123;  </span><br><span class="line">            log.error(<span class="string">&quot;Failed to pause job - &#123;&#125;&quot;</span>, jobName, e);  </span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">false</span>;  </span><br><span class="line">        &#125;  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 恢复 </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobName  job name </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobGroup job group </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">resumeJob</span><span class="params">(String jobName, String jobGroup)</span> </span>&#123;  </span><br><span class="line">        <span class="keyword">try</span> &#123;  </span><br><span class="line">            schedulerFactoryBean.getScheduler().resumeJob(<span class="keyword">new</span> JobKey(jobName, jobGroup));  </span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">true</span>;  </span><br><span class="line">        &#125; <span class="keyword">catch</span> (SchedulerException e) &#123;  </span><br><span class="line">            log.error(<span class="string">&quot;Failed to resume job - &#123;&#125;&quot;</span>, jobName, e);  </span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">false</span>;  </span><br><span class="line">        &#125;  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">startJobNow</span><span class="params">(String jobName, String jobGroup)</span> </span>&#123;  </span><br><span class="line">        <span class="keyword">try</span> &#123;  </span><br><span class="line">            schedulerFactoryBean.getScheduler().triggerJob(<span class="keyword">new</span> JobKey(jobName, jobGroup));  </span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">true</span>;  </span><br><span class="line">        &#125; <span class="keyword">catch</span> (SchedulerException e) &#123;  </span><br><span class="line">            log.error(<span class="string">&quot;Failed to start new job - &#123;&#125;&quot;</span>, jobName, e);  </span><br><span class="line">            <span class="keyword">return</span> <span class="keyword">false</span>;  </span><br><span class="line">        &#125;  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 分页查询 </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> pageable </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> cron     true: cron trigger, false: simple trigger </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@Transactional(readOnly = true)</span><span class="comment">// 方法上注解属性会覆盖类注解上的相同属性  </span></span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="keyword">public</span> Page&lt;Map&lt;String, Object&gt;&gt; findAll(Pageable pageable, Boolean cron) &#123;  </span><br><span class="line">        <span class="keyword">if</span> (cron) &#123;  </span><br><span class="line">            <span class="keyword">return</span> schedulerRepository.getJobWithCronTrigger(pageable);  </span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;  </span><br><span class="line">            <span class="keyword">return</span> schedulerRepository.getJobWithSimpleTrigger(pageable);  </span><br><span class="line">        &#125;  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 根据jobName查询单条记录 </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobName </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@Transactional(readOnly = true)</span>  </span><br><span class="line">    <span class="meta">@Override</span>  </span><br><span class="line">    <span class="function"><span class="keyword">public</span> SchedulerJob <span class="title">findOne</span><span class="params">(String jobName)</span> </span>&#123;  </span><br><span class="line">        <span class="keyword">return</span> schedulerRepository.findSchedulerJobByJobName(jobName);  </span><br><span class="line">    &#125;  </span><br><span class="line">  </span><br><span class="line">&#125;  </span><br></pre></td></tr></table></figure>

<h1 id="9-Dao层"><a href="#9-Dao层" class="headerlink" title="9.Dao层"></a>9.Dao层</h1><h2 id="9-1-SchedulerRepository"><a href="#9-1-SchedulerRepository" class="headerlink" title="9.1.SchedulerRepository"></a>9.1.SchedulerRepository</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.littlefxc.example.quartz.repository;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> com.littlefxc.example.quartz.enitiy.SchedulerJob;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.data.domain.Page;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.data.domain.Pageable;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.data.jpa.repository.JpaRepository;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.data.jpa.repository.Query;  </span><br><span class="line"><span class="keyword">import</span> org.springframework.stereotype.Repository;  </span><br><span class="line">  </span><br><span class="line"><span class="keyword">import</span> java.util.Map;  </span><br><span class="line">  </span><br><span class="line"><span class="comment">/** </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span> fengxuechao </span></span><br><span class="line"><span class="comment"> * <span class="doctag">@date</span> 12/19/2018 </span></span><br><span class="line"><span class="comment"> */</span>  </span><br><span class="line"><span class="meta">@Repository</span>  </span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">interface</span> <span class="title">SchedulerRepository</span> <span class="keyword">extends</span> <span class="title">JpaRepository</span>&lt;<span class="title">SchedulerJob</span>, <span class="title">Long</span>&gt; </span>&#123;  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 仅查询simple trigger关联的Job </span></span><br><span class="line"><span class="comment">     * 不查询cron trigger关联的job </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> pageable 分页信息 </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@Query(value = &quot;select &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;j.JOB_NAME, &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;j.JOB_GROUP, &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;j.JOB_CLASS_NAME, &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;t.TRIGGER_NAME, &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;t.TRIGGER_GROUP, &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;s.REPEAT_INTERVAL, &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;s.TIMES_TRIGGERED &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;from qrtz_job_details as j &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;join qrtz_triggers as t &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;join qrtz_simple_triggers as s ON j.JOB_NAME = t.JOB_NAME &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;and t.TRIGGER_NAME = s.TRIGGER_NAME &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;and t.TRIGGER_GROUP = s.TRIGGER_GROUP &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;where j.SCHED_NAME = &#x27;schedulerFactoryBean&#x27; &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;order by ?#&#123;#pageable&#125;&quot;,  </span></span><br><span class="line"><span class="meta">            countQuery = &quot;select count(1) &quot; +  </span></span><br><span class="line"><span class="meta">                    &quot;from qrtz_job_details as j &quot; +  </span></span><br><span class="line"><span class="meta">                    &quot;join qrtz_triggers as t &quot; +  </span></span><br><span class="line"><span class="meta">                    &quot;join qrtz_cron_triggers as c  ON j.JOB_NAME = t.JOB_NAME &quot; +  </span></span><br><span class="line"><span class="meta">                    &quot;and t.TRIGGER_NAME = c.TRIGGER_NAME &quot; +  </span></span><br><span class="line"><span class="meta">                    &quot;and t.TRIGGER_GROUP = c.TRIGGER_GROUP &quot; +  </span></span><br><span class="line"><span class="meta">                    &quot;where j.SCHED_NAME = &#x27;schedulerFactoryBean&#x27; &quot;,  </span></span><br><span class="line"><span class="meta">            nativeQuery = true)</span>  </span><br><span class="line">    Page&lt;Map&lt;String, Object&gt;&gt; getJobWithSimpleTrigger(Pageable pageable);  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 仅查询cron trigger关联的Job </span></span><br><span class="line"><span class="comment">     * 不查询simple trigger关联的job </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> pageable </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="meta">@Query(value = &quot;select &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;j.JOB_NAME, &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;j.JOB_GROUP, &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;j.JOB_CLASS_NAME, &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;t.TRIGGER_NAME, &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;t.TRIGGER_GROUP, &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;c.CRON_EXPRESSION, &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;c.TIME_ZONE_ID &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;from qrtz_job_details as j &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;join qrtz_triggers as t &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;join qrtz_cron_triggers as c ON j.JOB_NAME = t.JOB_NAME &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;and t.TRIGGER_NAME = c.TRIGGER_NAME &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;and t.TRIGGER_GROUP = c.TRIGGER_GROUP &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;where j.SCHED_NAME = &#x27;schedulerFactoryBean&#x27; &quot; +  </span></span><br><span class="line"><span class="meta">            &quot;order by ?#&#123;#pageable&#125;&quot;,  </span></span><br><span class="line"><span class="meta">            countQuery = &quot;select count(1) &quot; +  </span></span><br><span class="line"><span class="meta">                    &quot;from qrtz_job_details as j &quot; +  </span></span><br><span class="line"><span class="meta">                    &quot;join qrtz_triggers as t &quot; +  </span></span><br><span class="line"><span class="meta">                    &quot;join qrtz_cron_triggers as c  ON j.JOB_NAME = t.JOB_NAME &quot; +  </span></span><br><span class="line"><span class="meta">                    &quot;and t.TRIGGER_NAME = c.TRIGGER_NAME &quot; +  </span></span><br><span class="line"><span class="meta">                    &quot;and t.TRIGGER_GROUP = c.TRIGGER_GROUP &quot; +  </span></span><br><span class="line"><span class="meta">                    &quot;where j.SCHED_NAME = &#x27;schedulerFactoryBean&#x27; &quot;,  </span></span><br><span class="line"><span class="meta">            nativeQuery = true)</span>  </span><br><span class="line">    Page&lt;Map&lt;String, Object&gt;&gt; getJobWithCronTrigger(Pageable pageable);  </span><br><span class="line">  </span><br><span class="line">    <span class="comment">/** </span></span><br><span class="line"><span class="comment">     * 根据JobName查询SchedulerJob </span></span><br><span class="line"><span class="comment">     * </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> jobName </span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> SchedulerJob </span></span><br><span class="line"><span class="comment">     */</span>  </span><br><span class="line">    <span class="function">SchedulerJob <span class="title">findSchedulerJobByJobName</span><span class="params">(String jobName)</span></span>;  </span><br><span class="line">&#125;  </span><br></pre></td></tr></table></figure>

<h1 id="10-网页Vue-ElementUI实现"><a href="#10-网页Vue-ElementUI实现" class="headerlink" title="10.网页Vue+ElementUI实现"></a>10.网页Vue+ElementUI实现</h1><h2 id="10-1-simple-html"><a href="#10-1-simple-html" class="headerlink" title="10.1.simple.html"></a>10.1.simple.html</h2><p>仅对Simple Trigger管理</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br><span class="line">325</span><br><span class="line">326</span><br><span class="line">327</span><br><span class="line">328</span><br><span class="line">329</span><br><span class="line">330</span><br><span class="line">331</span><br><span class="line">332</span><br><span class="line">333</span><br><span class="line">334</span><br><span class="line">335</span><br><span class="line">336</span><br><span class="line">337</span><br><span class="line">338</span><br><span class="line">339</span><br><span class="line">340</span><br><span class="line">341</span><br><span class="line">342</span><br><span class="line">343</span><br><span class="line">344</span><br><span class="line">345</span><br><span class="line">346</span><br><span class="line">347</span><br><span class="line">348</span><br><span class="line">349</span><br><span class="line">350</span><br><span class="line">351</span><br><span class="line">352</span><br><span class="line">353</span><br><span class="line">354</span><br><span class="line">355</span><br><span class="line">356</span><br><span class="line">357</span><br><span class="line">358</span><br><span class="line">359</span><br><span class="line">360</span><br><span class="line">361</span><br><span class="line">362</span><br><span class="line">363</span><br><span class="line">364</span><br><span class="line">365</span><br><span class="line">366</span><br><span class="line">367</span><br><span class="line">368</span><br><span class="line">369</span><br><span class="line">370</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;!DOCTYPE <span class="meta-keyword">html</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">html</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">&quot;UTF-8&quot;</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">title</span>&gt;</span>QuartzDemo<span class="tag">&lt;/<span class="name">title</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">link</span> <span class="attr">rel</span>=<span class="string">&quot;stylesheet&quot;</span> <span class="attr">href</span>=<span class="string">&quot;https://unpkg.com/element-ui/lib/theme-chalk/index.css&quot;</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">&quot;https://unpkg.com/vue/dist/vue.js&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">script</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">&quot;https://cdn.bootcss.com/vue-resource/1.5.1/vue-resource.js&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">script</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">&quot;https://unpkg.com/element-ui/lib/index.js&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">script</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">style</span>&gt;</span>  </span><br><span class="line">        #top &#123;  </span><br><span class="line"><span class="css">            <span class="attribute">background</span>: <span class="number">#20A0FF</span>;  </span></span><br><span class="line"><span class="css">            <span class="attribute">padding</span>: <span class="number">5px</span>;  </span></span><br><span class="line"><span class="css">            <span class="attribute">overflow</span>: hidden  </span></span><br><span class="line">        &#125;  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">style</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">&quot;test&quot;</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">&quot;cron.html&quot;</span>&gt;</span>goto simple.html<span class="tag">&lt;/<span class="name">a</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">&quot;top&quot;</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">el-button</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> @<span class="attr">click</span>=<span class="string">&quot;search&quot;</span> <span class="attr">style</span>=<span class="string">&quot;color:white&quot;</span>&gt;</span>查询<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">el-button</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> @<span class="attr">click</span>=<span class="string">&quot;handleadd&quot;</span> <span class="attr">style</span>=<span class="string">&quot;color:white&quot;</span>&gt;</span>添加<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">span</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">div</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">br</span>/&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">style</span>=<span class="string">&quot;margin-top:15px&quot;</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">        <span class="tag">&lt;<span class="name">el-table</span>  </span></span><br><span class="line"><span class="tag">                <span class="attr">ref</span>=<span class="string">&quot;testTable&quot;</span>  </span></span><br><span class="line"><span class="tag">                <span class="attr">:data</span>=<span class="string">&quot;tableData&quot;</span>  </span></span><br><span class="line"><span class="tag">                <span class="attr">style</span>=<span class="string">&quot;width:100%&quot;</span>  </span></span><br><span class="line"><span class="tag">                <span class="attr">border</span>  </span></span><br><span class="line"><span class="tag">        &gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;JOB_NAME&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;任务名称&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">show-overflow-tooltip</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;JOB_GROUP&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;任务所在组&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;JOB_CLASS_NAME&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;任务类名&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;TRIGGER_NAME&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;触发器名称&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;TRIGGER_GROUP&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;触发器所在组&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;REPEAT_INTERVAL&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;触发间隔(毫秒)&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;TIMES_TRIGGERED&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;已触发次数&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span> <span class="attr">label</span>=<span class="string">&quot;操作&quot;</span> <span class="attr">width</span>=<span class="string">&quot;300&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">template</span> <span class="attr">scope</span>=<span class="string">&quot;scope&quot;</span>&gt;</span>  </span><br><span class="line">                    <span class="tag">&lt;<span class="name">el-button</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">size</span>=<span class="string">&quot;small&quot;</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">type</span>=<span class="string">&quot;warning&quot;</span>  </span></span><br><span class="line"><span class="tag">                            @<span class="attr">click</span>=<span class="string">&quot;handlePause(scope.$index, scope.row)&quot;</span>&gt;</span>暂停  </span><br><span class="line">                    <span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">                    <span class="tag">&lt;<span class="name">el-button</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">size</span>=<span class="string">&quot;small&quot;</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">type</span>=<span class="string">&quot;info&quot;</span>  </span></span><br><span class="line"><span class="tag">                            @<span class="attr">click</span>=<span class="string">&quot;handleResume(scope.$index, scope.row)&quot;</span>&gt;</span>恢复  </span><br><span class="line">                    <span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">                    <span class="tag">&lt;<span class="name">el-button</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">size</span>=<span class="string">&quot;small&quot;</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">type</span>=<span class="string">&quot;danger&quot;</span>  </span></span><br><span class="line"><span class="tag">                            @<span class="attr">click</span>=<span class="string">&quot;handleDelete(scope.$index, scope.row)&quot;</span>&gt;</span>删除  </span><br><span class="line">                    <span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">                    <span class="tag">&lt;<span class="name">el-button</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">size</span>=<span class="string">&quot;small&quot;</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">type</span>=<span class="string">&quot;success&quot;</span>  </span></span><br><span class="line"><span class="tag">                            @<span class="attr">click</span>=<span class="string">&quot;handleUpdate(scope.$index, scope.row)&quot;</span>&gt;</span>修改  </span><br><span class="line">                    <span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;/<span class="name">template</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">el-table</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">        <span class="tag">&lt;<span class="name">div</span> <span class="attr">align</span>=<span class="string">&quot;center&quot;</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-pagination</span>  </span></span><br><span class="line"><span class="tag">                    @<span class="attr">size-change</span>=<span class="string">&quot;handleSizeChange&quot;</span>  </span></span><br><span class="line"><span class="tag">                    @<span class="attr">current-change</span>=<span class="string">&quot;handleCurrentChange&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">:current-page</span>=<span class="string">&quot;currentPage&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">:page-sizes</span>=<span class="string">&quot;[10, 20, 30, 40]&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">:page-size</span>=<span class="string">&quot;pagesize&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">layout</span>=<span class="string">&quot;total, sizes, prev, pager, next, jumper&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">:total</span>=<span class="string">&quot;totalCount&quot;</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-pagination</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">div</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">div</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">el-dialog</span> <span class="attr">title</span>=<span class="string">&quot;添加任务&quot;</span> <span class="attr">:visible.syn</span>=<span class="string">&quot;dialogFormVisible&quot;</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">el-form</span> <span class="attr">:model</span>=<span class="string">&quot;form&quot;</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;任务名称&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;form.jobName&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;任务分组&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;form.jobGroup&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;任务类名&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;form.jobClass&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;触发器类型&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-switch</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">v-model</span>=<span class="string">&quot;form.cronJob&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">active-color</span>=<span class="string">&quot;#13ce66&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">inactive-color</span>=<span class="string">&quot;#ff4949&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">active-text</span>=<span class="string">&quot;cron&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">inactive-text</span>=<span class="string">&quot;simple&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;/<span class="name">el-switch</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;表达式&quot;</span> <span class="attr">v-show</span>=<span class="string">&quot;form.cronJob&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;form.cronExpression&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;触发间隔(毫秒)&quot;</span> <span class="attr">v-show</span>=<span class="string">&quot;!form.cronJob&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;form.repeatTime&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">el-form</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">div</span> <span class="attr">slot</span>=<span class="string">&quot;footer&quot;</span> <span class="attr">class</span>=<span class="string">&quot;dialog-footer&quot;</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-button</span> @<span class="attr">click</span>=<span class="string">&quot;dialogFormVisible = false&quot;</span>&gt;</span>取 消<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-button</span> <span class="attr">type</span>=<span class="string">&quot;primary&quot;</span> @<span class="attr">click</span>=<span class="string">&quot;add&quot;</span>&gt;</span>确 定<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">div</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">el-dialog</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">el-dialog</span> <span class="attr">title</span>=<span class="string">&quot;修改任务&quot;</span> <span class="attr">:visible.syn</span>=<span class="string">&quot;updateFormVisible&quot;</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">el-form</span> <span class="attr">:model</span>=<span class="string">&quot;updateform&quot;</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;任务名称&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;updateform.jobName&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;任务分组&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;updateform.jobGroup&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;任务类名&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;updateform.jobClass&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;触发器类型&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-switch</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">v-model</span>=<span class="string">&quot;updateform.cronJob&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">active-color</span>=<span class="string">&quot;#13ce66&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">inactive-color</span>=<span class="string">&quot;#ff4949&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">active-text</span>=<span class="string">&quot;cron&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">inactive-text</span>=<span class="string">&quot;simple&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;/<span class="name">el-switch</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;表达式&quot;</span> <span class="attr">v-show</span>=<span class="string">&quot;updateform.cronJob&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;updateform.cronExpression&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;触发间隔(毫秒)&quot;</span> <span class="attr">v-show</span>=<span class="string">&quot;!updateform.cronJob&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;updateform.repeatTime&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">el-form</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">div</span> <span class="attr">slot</span>=<span class="string">&quot;footer&quot;</span> <span class="attr">class</span>=<span class="string">&quot;dialog-footer&quot;</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-button</span> @<span class="attr">click</span>=<span class="string">&quot;updateFormVisible = false&quot;</span>&gt;</span>取 消<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-button</span> <span class="attr">type</span>=<span class="string">&quot;primary&quot;</span> @<span class="attr">click</span>=<span class="string">&quot;update&quot;</span>&gt;</span>确 定<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">div</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">el-dialog</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line"><span class="tag">&lt;<span class="name">footer</span> <span class="attr">align</span>=<span class="string">&quot;center&quot;</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">p</span>&gt;</span>© Quartz 任务管理<span class="tag">&lt;/<span class="name">p</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;/<span class="name">footer</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line"><span class="tag">&lt;<span class="name">script</span>&gt;</span>  </span><br><span class="line"><span class="javascript">    <span class="keyword">var</span> vue = <span class="keyword">new</span> Vue(&#123;  </span></span><br><span class="line"><span class="javascript">        el: <span class="string">&quot;#test&quot;</span>,  </span></span><br><span class="line">        data: &#123;  </span><br><span class="line"><span class="javascript">            <span class="comment">//表格当前页数据  </span></span></span><br><span class="line">            tableData: [],  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//请求的URL  </span></span></span><br><span class="line"><span class="javascript">            url: <span class="string">&#x27;&#x27;</span>,  </span></span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//默认每页数据量  </span></span></span><br><span class="line">            pagesize: 10,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//当前页码  </span></span></span><br><span class="line">            currentPage: 1,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//查询的页码  </span></span></span><br><span class="line">            start: 1,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//默认数据总数  </span></span></span><br><span class="line">            totalCount: 1000,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//添加对话框默认可见性  </span></span></span><br><span class="line"><span class="javascript">            dialogFormVisible: <span class="literal">false</span>,  </span></span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//修改对话框默认可见性  </span></span></span><br><span class="line"><span class="javascript">            updateFormVisible: <span class="literal">false</span>,  </span></span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//提交的表单  </span></span></span><br><span class="line">            form: &#123;  </span><br><span class="line"><span class="javascript">                jobName: <span class="string">&#x27;&#x27;</span>,  </span></span><br><span class="line"><span class="javascript">                jobGroup: <span class="string">&#x27;&#x27;</span>,  </span></span><br><span class="line"><span class="javascript">                jobClass: <span class="string">&#x27;&#x27;</span>,  </span></span><br><span class="line"><span class="javascript">                cronJob: <span class="literal">false</span>,  </span></span><br><span class="line">                repeatTime: 0,  </span><br><span class="line"><span class="javascript">                cronExpression: <span class="string">&#x27;&#x27;</span>  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">// 修改的表单  </span></span></span><br><span class="line">            updateform: &#123;  </span><br><span class="line">                id: 0,  </span><br><span class="line"><span class="javascript">                jobName: <span class="string">&#x27;&#x27;</span>,  </span></span><br><span class="line"><span class="javascript">                jobGroup: <span class="string">&#x27;&#x27;</span>,  </span></span><br><span class="line"><span class="javascript">                jobClass: <span class="string">&#x27;&#x27;</span>,  </span></span><br><span class="line"><span class="javascript">                cronJob: <span class="literal">false</span>,  </span></span><br><span class="line">                repeatTime: 0,  </span><br><span class="line"><span class="javascript">                cronExpression: <span class="string">&#x27;&#x27;</span>  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">        &#125;,  </span><br><span class="line">  </span><br><span class="line">        methods: &#123;  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//从服务器读取数据  </span></span></span><br><span class="line"><span class="javascript">            loadData: <span class="function"><span class="keyword">function</span> (<span class="params">pageNum, pageSize</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.get(<span class="string">&#x27;job/queryjob?cron=false&amp;&#x27;</span> + <span class="string">&#x27;page=&#x27;</span> + pageNum + <span class="string">&#x27;&amp;size=&#x27;</span> + pageSize).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(res);  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.tableData = res.body.content;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.totalCount = res.body.numberOfElements;  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//单行删除  </span></span></span><br><span class="line"><span class="javascript">            handleDelete: <span class="function"><span class="keyword">function</span> (<span class="params">index, row</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.post(<span class="string">&#x27;job/deletejob&#x27;</span>, &#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="string">&quot;jobName&quot;</span>: row.JOB_NAME,  </span></span><br><span class="line"><span class="javascript">                    <span class="string">&quot;jobGroup&quot;</span>: row.JOB_GROUP  </span></span><br><span class="line"><span class="javascript">                &#125;, &#123;<span class="attr">emulateJSON</span>: <span class="literal">true</span>&#125;).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//暂停任务  </span></span></span><br><span class="line"><span class="javascript">            handlePause: <span class="function"><span class="keyword">function</span> (<span class="params">index, row</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.post(<span class="string">&#x27;job/pausejob&#x27;</span>, &#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="string">&quot;jobName&quot;</span>: row.JOB_NAME,  </span></span><br><span class="line"><span class="javascript">                    <span class="string">&quot;jobGroup&quot;</span>: row.JOB_GROUP  </span></span><br><span class="line"><span class="javascript">                &#125;, &#123;<span class="attr">emulateJSON</span>: <span class="literal">true</span>&#125;).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//恢复任务  </span></span></span><br><span class="line"><span class="javascript">            handleResume: <span class="function"><span class="keyword">function</span> (<span class="params">index, row</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.post(<span class="string">&#x27;job/resumejob&#x27;</span>, &#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="string">&quot;jobName&quot;</span>: row.JOB_NAME,  </span></span><br><span class="line"><span class="javascript">                    <span class="string">&quot;jobGroup&quot;</span>: row.JOB_GROUP  </span></span><br><span class="line"><span class="javascript">                &#125;, &#123;<span class="attr">emulateJSON</span>: <span class="literal">true</span>&#125;).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//搜索  </span></span></span><br><span class="line"><span class="javascript">            search: <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//弹出对话框  </span></span></span><br><span class="line"><span class="javascript">            handleadd: <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.dialogFormVisible = <span class="literal">true</span>;  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//添加  </span></span></span><br><span class="line"><span class="javascript">            add: <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.post(<span class="string">&#x27;job/addjob&#x27;</span>, <span class="built_in">this</span>.form, &#123;  </span></span><br><span class="line"><span class="javascript">                    headers: &#123;<span class="string">&#x27;Content-Type&#x27;</span>: <span class="string">&quot;application/json;charset=utf-8&quot;</span>&#125;  </span></span><br><span class="line"><span class="javascript">                &#125;).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.dialogFormVisible = <span class="literal">false</span>;  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//更新  </span></span></span><br><span class="line"><span class="javascript">            handleUpdate: <span class="function"><span class="keyword">function</span> (<span class="params">index, row</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">console</span>.log(row);  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.updateFormVisible = <span class="literal">true</span>;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.updateform.jobName = row.JOB_NAME;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.updateform.jobGroup = row.JOB_GROUP;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.updateform.jobClass = row.JOB_CLASS_NAME;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.updateform.cronJob = <span class="literal">false</span>;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.updateform.repeatTime = row.REPEAT_INTERVAL;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.get(<span class="string">&#x27;job-info/findOne?jobName=&#x27;</span> + row.JOB_NAME).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.updateform.id = res.body.id;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.updateform.cronExpression = row.cronExpression;  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line"><span class="javascript">                <span class="built_in">console</span>.log(<span class="built_in">this</span>.updateform)  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//更新任务  </span></span></span><br><span class="line"><span class="javascript">            update: <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.post(<span class="string">&#x27;job/reschedulejob&#x27;</span>, <span class="built_in">this</span>.updateform, &#123;  </span></span><br><span class="line"><span class="javascript">                    headers: &#123;<span class="string">&#x27;Content-Type&#x27;</span>: <span class="string">&quot;application/json;charset=utf-8&quot;</span>&#125;  </span></span><br><span class="line"><span class="javascript">                &#125;).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.updateFormVisible = <span class="literal">false</span>;  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line">  </span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//每页显示数据量变更  </span></span></span><br><span class="line"><span class="javascript">            handleSizeChange: <span class="function"><span class="keyword">function</span> (<span class="params">val</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.pagesize = val;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//页码变更  </span></span></span><br><span class="line"><span class="javascript">            handleCurrentChange: <span class="function"><span class="keyword">function</span> (<span class="params">val</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.currentPage = val;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">        &#125;,  </span><br><span class="line">  </span><br><span class="line">    &#125;);  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">    <span class="comment">//载入数据  </span></span></span><br><span class="line">    vue.loadData(vue.currentPage, vue.pagesize);  </span><br><span class="line"><span class="tag">&lt;/<span class="name">script</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span>  </span><br></pre></td></tr></table></figure>

<h2 id="10-2-cron-html"><a href="#10-2-cron-html" class="headerlink" title="10.2.cron.html"></a>10.2.cron.html</h2><p>进队Cron Trigger 管理</p>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br><span class="line">325</span><br><span class="line">326</span><br><span class="line">327</span><br><span class="line">328</span><br><span class="line">329</span><br><span class="line">330</span><br><span class="line">331</span><br><span class="line">332</span><br><span class="line">333</span><br><span class="line">334</span><br><span class="line">335</span><br><span class="line">336</span><br><span class="line">337</span><br><span class="line">338</span><br><span class="line">339</span><br><span class="line">340</span><br><span class="line">341</span><br><span class="line">342</span><br><span class="line">343</span><br><span class="line">344</span><br><span class="line">345</span><br><span class="line">346</span><br><span class="line">347</span><br><span class="line">348</span><br><span class="line">349</span><br><span class="line">350</span><br><span class="line">351</span><br><span class="line">352</span><br><span class="line">353</span><br><span class="line">354</span><br><span class="line">355</span><br><span class="line">356</span><br><span class="line">357</span><br><span class="line">358</span><br><span class="line">359</span><br><span class="line">360</span><br><span class="line">361</span><br><span class="line">362</span><br><span class="line">363</span><br><span class="line">364</span><br><span class="line">365</span><br><span class="line">366</span><br><span class="line">367</span><br><span class="line">368</span><br><span class="line">369</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;!DOCTYPE <span class="meta-keyword">html</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">html</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">&quot;UTF-8&quot;</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">title</span>&gt;</span>QuartzDemo<span class="tag">&lt;/<span class="name">title</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">link</span> <span class="attr">rel</span>=<span class="string">&quot;stylesheet&quot;</span> <span class="attr">href</span>=<span class="string">&quot;https://unpkg.com/element-ui/lib/theme-chalk/index.css&quot;</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">&quot;https://unpkg.com/vue/dist/vue.js&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">script</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">&quot;http://cdn.bootcss.com/vue-resource/1.3.4/vue-resource.js&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">script</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">script</span> <span class="attr">src</span>=<span class="string">&quot;https://unpkg.com/element-ui/lib/index.js&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">script</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">style</span>&gt;</span>  </span><br><span class="line">        #top &#123;  </span><br><span class="line"><span class="css">            <span class="attribute">background</span>: <span class="number">#20A0FF</span>;  </span></span><br><span class="line"><span class="css">            <span class="attribute">padding</span>: <span class="number">5px</span>;  </span></span><br><span class="line"><span class="css">            <span class="attribute">overflow</span>: hidden  </span></span><br><span class="line">        &#125;  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">style</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">&quot;test&quot;</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">a</span> <span class="attr">href</span>=<span class="string">&quot;simple.html&quot;</span>&gt;</span>goto cron.html<span class="tag">&lt;/<span class="name">a</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">id</span>=<span class="string">&quot;top&quot;</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">el-button</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> @<span class="attr">click</span>=<span class="string">&quot;search&quot;</span> <span class="attr">style</span>=<span class="string">&quot;color:white&quot;</span>&gt;</span>查询<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">el-button</span> <span class="attr">type</span>=<span class="string">&quot;text&quot;</span> @<span class="attr">click</span>=<span class="string">&quot;handleadd&quot;</span> <span class="attr">style</span>=<span class="string">&quot;color:white&quot;</span>&gt;</span>添加<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">span</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">div</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">br</span>/&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">div</span> <span class="attr">style</span>=<span class="string">&quot;margin-top:15px&quot;</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">        <span class="tag">&lt;<span class="name">el-table</span>  </span></span><br><span class="line"><span class="tag">                <span class="attr">ref</span>=<span class="string">&quot;testTable&quot;</span>  </span></span><br><span class="line"><span class="tag">                <span class="attr">:data</span>=<span class="string">&quot;tableData&quot;</span>  </span></span><br><span class="line"><span class="tag">                <span class="attr">style</span>=<span class="string">&quot;width:100%&quot;</span>  </span></span><br><span class="line"><span class="tag">                <span class="attr">border</span>  </span></span><br><span class="line"><span class="tag">        &gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;JOB_NAME&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;任务名称&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">show-overflow-tooltip</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;JOB_GROUP&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;任务所在组&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;JOB_CLASS_NAME&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;任务类名&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;TRIGGER_NAME&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;触发器名称&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;TRIGGER_GROUP&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;触发器所在组&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;CRON_EXPRESSION&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;表达式&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">prop</span>=<span class="string">&quot;TIME_ZONE_ID&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">label</span>=<span class="string">&quot;时区&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">sortable</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-table-column</span> <span class="attr">label</span>=<span class="string">&quot;操作&quot;</span> <span class="attr">width</span>=<span class="string">&quot;300&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">template</span> <span class="attr">scope</span>=<span class="string">&quot;scope&quot;</span>&gt;</span>  </span><br><span class="line">                    <span class="tag">&lt;<span class="name">el-button</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">size</span>=<span class="string">&quot;small&quot;</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">type</span>=<span class="string">&quot;warning&quot;</span>  </span></span><br><span class="line"><span class="tag">                            @<span class="attr">click</span>=<span class="string">&quot;handlePause(scope.$index, scope.row)&quot;</span>&gt;</span>暂停  </span><br><span class="line">                    <span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">                    <span class="tag">&lt;<span class="name">el-button</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">size</span>=<span class="string">&quot;small&quot;</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">type</span>=<span class="string">&quot;info&quot;</span>  </span></span><br><span class="line"><span class="tag">                            @<span class="attr">click</span>=<span class="string">&quot;handleResume(scope.$index, scope.row)&quot;</span>&gt;</span>恢复  </span><br><span class="line">                    <span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">                    <span class="tag">&lt;<span class="name">el-button</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">size</span>=<span class="string">&quot;small&quot;</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">type</span>=<span class="string">&quot;danger&quot;</span>  </span></span><br><span class="line"><span class="tag">                            @<span class="attr">click</span>=<span class="string">&quot;handleDelete(scope.$index, scope.row)&quot;</span>&gt;</span>删除  </span><br><span class="line">                    <span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">                    <span class="tag">&lt;<span class="name">el-button</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">size</span>=<span class="string">&quot;small&quot;</span>  </span></span><br><span class="line"><span class="tag">                            <span class="attr">type</span>=<span class="string">&quot;success&quot;</span>  </span></span><br><span class="line"><span class="tag">                            @<span class="attr">click</span>=<span class="string">&quot;handleUpdate(scope.$index, scope.row)&quot;</span>&gt;</span>修改  </span><br><span class="line">                    <span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;/<span class="name">template</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-table-column</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">el-table</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">        <span class="tag">&lt;<span class="name">div</span> <span class="attr">align</span>=<span class="string">&quot;center&quot;</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-pagination</span>  </span></span><br><span class="line"><span class="tag">                    @<span class="attr">size-change</span>=<span class="string">&quot;handleSizeChange&quot;</span>  </span></span><br><span class="line"><span class="tag">                    @<span class="attr">current-change</span>=<span class="string">&quot;handleCurrentChange&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">:current-page</span>=<span class="string">&quot;currentPage&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">:page-sizes</span>=<span class="string">&quot;[10, 20, 30, 40]&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">:page-size</span>=<span class="string">&quot;pagesize&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">layout</span>=<span class="string">&quot;total, sizes, prev, pager, next, jumper&quot;</span>  </span></span><br><span class="line"><span class="tag">                    <span class="attr">:total</span>=<span class="string">&quot;totalCount&quot;</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-pagination</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">div</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">div</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">el-dialog</span> <span class="attr">title</span>=<span class="string">&quot;添加任务&quot;</span> <span class="attr">:visible.syn</span>=<span class="string">&quot;dialogFormVisible&quot;</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">el-form</span> <span class="attr">:model</span>=<span class="string">&quot;form&quot;</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;任务名称&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;form.jobName&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;任务分组&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;form.jobGroup&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;任务类名&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;form.jobClass&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;触发器类型&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-switch</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">v-model</span>=<span class="string">&quot;form.cronJob&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">active-color</span>=<span class="string">&quot;#13ce66&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">inactive-color</span>=<span class="string">&quot;#ff4949&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">active-text</span>=<span class="string">&quot;cron&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">inactive-text</span>=<span class="string">&quot;simple&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;/<span class="name">el-switch</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;表达式&quot;</span> <span class="attr">v-show</span>=<span class="string">&quot;form.cronJob&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;form.cronExpression&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;触发间隔(毫秒)&quot;</span> <span class="attr">v-show</span>=<span class="string">&quot;!form.cronJob&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;form.repeatTime&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">el-form</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">div</span> <span class="attr">slot</span>=<span class="string">&quot;footer&quot;</span> <span class="attr">class</span>=<span class="string">&quot;dialog-footer&quot;</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-button</span> @<span class="attr">click</span>=<span class="string">&quot;dialogFormVisible = false&quot;</span>&gt;</span>取 消<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-button</span> <span class="attr">type</span>=<span class="string">&quot;primary&quot;</span> @<span class="attr">click</span>=<span class="string">&quot;add&quot;</span>&gt;</span>确 定<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">div</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">el-dialog</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line">    <span class="tag">&lt;<span class="name">el-dialog</span> <span class="attr">title</span>=<span class="string">&quot;修改任务&quot;</span> <span class="attr">:visible.syn</span>=<span class="string">&quot;updateFormVisible&quot;</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">el-form</span> <span class="attr">:model</span>=<span class="string">&quot;updateform&quot;</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;任务名称&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;updateform.jobName&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;任务分组&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;updateform.jobGroup&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;任务类名&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;updateform.jobClass&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;触发器类型&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-switch</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">v-model</span>=<span class="string">&quot;updateform.cronJob&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">active-color</span>=<span class="string">&quot;#13ce66&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">inactive-color</span>=<span class="string">&quot;#ff4949&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">active-text</span>=<span class="string">&quot;cron&quot;</span>  </span></span><br><span class="line"><span class="tag">                        <span class="attr">inactive-text</span>=<span class="string">&quot;simple&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;/<span class="name">el-switch</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;表达式&quot;</span> <span class="attr">v-show</span>=<span class="string">&quot;updateform.cronJob&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;updateform.cronExpression&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-form-item</span> <span class="attr">label</span>=<span class="string">&quot;触发间隔(毫秒)&quot;</span> <span class="attr">v-show</span>=<span class="string">&quot;!updateform.cronJob&quot;</span> <span class="attr">label-width</span>=<span class="string">&quot;120px&quot;</span> <span class="attr">style</span>=<span class="string">&quot;width:35%&quot;</span>&gt;</span>  </span><br><span class="line">                <span class="tag">&lt;<span class="name">el-input</span> <span class="attr">v-model</span>=<span class="string">&quot;updateform.repeatTime&quot;</span> <span class="attr">auto-complete</span>=<span class="string">&quot;off&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">el-input</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;/<span class="name">el-form-item</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">el-form</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;<span class="name">div</span> <span class="attr">slot</span>=<span class="string">&quot;footer&quot;</span> <span class="attr">class</span>=<span class="string">&quot;dialog-footer&quot;</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-button</span> @<span class="attr">click</span>=<span class="string">&quot;updateFormVisible = false&quot;</span>&gt;</span>取 消<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">            <span class="tag">&lt;<span class="name">el-button</span> <span class="attr">type</span>=<span class="string">&quot;primary&quot;</span> @<span class="attr">click</span>=<span class="string">&quot;update&quot;</span>&gt;</span>确 定<span class="tag">&lt;/<span class="name">el-button</span>&gt;</span>  </span><br><span class="line">        <span class="tag">&lt;/<span class="name">div</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;/<span class="name">el-dialog</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line"><span class="tag">&lt;/<span class="name">div</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line"><span class="tag">&lt;<span class="name">footer</span> <span class="attr">align</span>=<span class="string">&quot;center&quot;</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">p</span>&gt;</span>© Quartz 任务管理<span class="tag">&lt;/<span class="name">p</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;/<span class="name">footer</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line"><span class="tag">&lt;<span class="name">script</span>&gt;</span>  </span><br><span class="line"><span class="javascript">    <span class="keyword">var</span> vue = <span class="keyword">new</span> Vue(&#123;  </span></span><br><span class="line"><span class="javascript">        el: <span class="string">&quot;#test&quot;</span>,  </span></span><br><span class="line">        data: &#123;  </span><br><span class="line"><span class="javascript">            <span class="comment">//表格当前页数据  </span></span></span><br><span class="line">            tableData: [],  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//请求的URL  </span></span></span><br><span class="line"><span class="javascript">            url: <span class="string">&#x27;job/queryjob&#x27;</span>,  </span></span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//默认每页数据量  </span></span></span><br><span class="line">            pagesize: 10,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//当前页码  </span></span></span><br><span class="line">            currentPage: 1,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//查询的页码  </span></span></span><br><span class="line">            start: 1,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//默认数据总数  </span></span></span><br><span class="line">            totalCount: 1000,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//添加对话框默认可见性  </span></span></span><br><span class="line"><span class="javascript">            dialogFormVisible: <span class="literal">false</span>,  </span></span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//修改对话框默认可见性  </span></span></span><br><span class="line"><span class="javascript">            updateFormVisible: <span class="literal">false</span>,  </span></span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//提交的表单  </span></span></span><br><span class="line">            form: &#123;  </span><br><span class="line"><span class="javascript">                jobName: <span class="string">&#x27;&#x27;</span>,  </span></span><br><span class="line"><span class="javascript">                jobGroup: <span class="string">&#x27;&#x27;</span>,  </span></span><br><span class="line"><span class="javascript">                jobClass: <span class="string">&#x27;&#x27;</span>,  </span></span><br><span class="line"><span class="javascript">                cronJob: <span class="literal">true</span>,  </span></span><br><span class="line">                repeatTime: 0,  </span><br><span class="line"><span class="javascript">                cronExpression: <span class="string">&#x27;&#x27;</span>  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">// 修改的表单  </span></span></span><br><span class="line">            updateform: &#123;  </span><br><span class="line">                id: 0,  </span><br><span class="line"><span class="javascript">                jobName: <span class="string">&#x27;&#x27;</span>,  </span></span><br><span class="line"><span class="javascript">                jobGroup: <span class="string">&#x27;&#x27;</span>,  </span></span><br><span class="line"><span class="javascript">                jobClass: <span class="string">&#x27;&#x27;</span>,  </span></span><br><span class="line"><span class="javascript">                cronJob: <span class="literal">true</span>,  </span></span><br><span class="line">                repeatTime: 0,  </span><br><span class="line"><span class="javascript">                cronExpression: <span class="string">&#x27;&#x27;</span>  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">        &#125;,  </span><br><span class="line">  </span><br><span class="line">        methods: &#123;  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//从服务器读取数据  </span></span></span><br><span class="line"><span class="javascript">            loadData: <span class="function"><span class="keyword">function</span> (<span class="params">pageNum, pageSize</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.get(<span class="string">&#x27;job/queryjob?cron=true&amp;&#x27;</span> + <span class="string">&#x27;page=&#x27;</span> + pageNum + <span class="string">&#x27;&amp;size=&#x27;</span> + pageSize).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(res);  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.tableData = res.body.content;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.totalCount = res.body.numberOfElements;  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//单行删除  </span></span></span><br><span class="line"><span class="javascript">            handleDelete: <span class="function"><span class="keyword">function</span> (<span class="params">index, row</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.post(<span class="string">&#x27;job/deletejob&#x27;</span>, &#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="string">&quot;jobName&quot;</span>: row.JOB_NAME,  </span></span><br><span class="line"><span class="javascript">                    <span class="string">&quot;jobGroup&quot;</span>: row.JOB_GROUP  </span></span><br><span class="line"><span class="javascript">                &#125;, &#123;<span class="attr">emulateJSON</span>: <span class="literal">true</span>&#125;).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//暂停任务  </span></span></span><br><span class="line"><span class="javascript">            handlePause: <span class="function"><span class="keyword">function</span> (<span class="params">index, row</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.post(<span class="string">&#x27;job/pausejob&#x27;</span>, &#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="string">&quot;jobName&quot;</span>: row.JOB_NAME,  </span></span><br><span class="line"><span class="javascript">                    <span class="string">&quot;jobGroup&quot;</span>: row.JOB_GROUP  </span></span><br><span class="line"><span class="javascript">                &#125;, &#123;<span class="attr">emulateJSON</span>: <span class="literal">true</span>&#125;).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//恢复任务  </span></span></span><br><span class="line"><span class="javascript">            handleResume: <span class="function"><span class="keyword">function</span> (<span class="params">index, row</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.post(<span class="string">&#x27;job/resumejob&#x27;</span>, &#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="string">&quot;jobName&quot;</span>: row.JOB_NAME,  </span></span><br><span class="line"><span class="javascript">                    <span class="string">&quot;jobGroup&quot;</span>: row.JOB_GROUP  </span></span><br><span class="line"><span class="javascript">                &#125;, &#123;<span class="attr">emulateJSON</span>: <span class="literal">true</span>&#125;).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//搜索  </span></span></span><br><span class="line"><span class="javascript">            search: <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//弹出对话框  </span></span></span><br><span class="line"><span class="javascript">            handleadd: <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.dialogFormVisible = <span class="literal">true</span>;  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//添加  </span></span></span><br><span class="line"><span class="javascript">            add: <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.post(<span class="string">&#x27;job/addjob&#x27;</span>, <span class="built_in">this</span>.form, &#123;  </span></span><br><span class="line"><span class="javascript">                    headers: &#123;<span class="string">&#x27;Content-Type&#x27;</span>: <span class="string">&quot;application/json;charset=utf-8&quot;</span>&#125;  </span></span><br><span class="line"><span class="javascript">                &#125;).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.dialogFormVisible = <span class="literal">false</span>;  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//更新  </span></span></span><br><span class="line"><span class="javascript">            handleUpdate: <span class="function"><span class="keyword">function</span> (<span class="params">index, row</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">console</span>.log(row);  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.updateFormVisible = <span class="literal">true</span>;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.updateform.jobName = row.JOB_NAME;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.updateform.jobGroup = row.JOB_GROUP;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.updateform.jobClass = row.JOB_CLASS_NAME;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.updateform.cronJob = <span class="literal">true</span>;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.updateform.cronExpression = row.CRON_EXPRESSION;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.get(<span class="string">&#x27;job-info/findOne?jobName=&#x27;</span> + row.JOB_NAME).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.updateform.id = res.body.id;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.updateform.repeatTime = res.body.repeatTime;  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line"><span class="javascript">                <span class="built_in">console</span>.log(<span class="built_in">this</span>.updateform)  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//更新任务  </span></span></span><br><span class="line"><span class="javascript">            update: <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.$http.post(<span class="string">&#x27;job/reschedulejob&#x27;</span>, <span class="built_in">this</span>.updateform, &#123;  </span></span><br><span class="line"><span class="javascript">                    headers: &#123;<span class="string">&#x27;Content-Type&#x27;</span>: <span class="string">&quot;application/json;charset=utf-8&quot;</span>&#125;  </span></span><br><span class="line"><span class="javascript">                &#125;).then(<span class="function"><span class="keyword">function</span> (<span class="params">res</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">this</span>.updateFormVisible = <span class="literal">false</span>;  </span></span><br><span class="line"><span class="javascript">                &#125;, <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                    <span class="built_in">console</span>.log(<span class="string">&#x27;failed&#x27;</span>);  </span></span><br><span class="line">                &#125;);  </span><br><span class="line">  </span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//每页显示数据量变更  </span></span></span><br><span class="line"><span class="javascript">            handleSizeChange: <span class="function"><span class="keyword">function</span> (<span class="params">val</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.pagesize = val;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">  </span><br><span class="line"><span class="javascript">            <span class="comment">//页码变更  </span></span></span><br><span class="line"><span class="javascript">            handleCurrentChange: <span class="function"><span class="keyword">function</span> (<span class="params">val</span>) </span>&#123;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.currentPage = val;  </span></span><br><span class="line"><span class="javascript">                <span class="built_in">this</span>.loadData(<span class="built_in">this</span>.currentPage, <span class="built_in">this</span>.pagesize);  </span></span><br><span class="line">            &#125;,  </span><br><span class="line">        &#125;,  </span><br><span class="line">  </span><br><span class="line">    &#125;);  </span><br><span class="line"><span class="javascript">    <span class="comment">//载入数据  </span></span></span><br><span class="line">    vue.loadData(vue.currentPage, vue.pagesize);  </span><br><span class="line"><span class="tag">&lt;/<span class="name">script</span>&gt;</span>  </span><br><span class="line">  </span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span>  </span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span>  </span><br></pre></td></tr></table></figure>
<h1 id="11-引用"><a href="#11-引用" class="headerlink" title="11. 引用"></a>11. 引用</h1><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/u012907049/article/details/73801122">https://blog.csdn.net/u012907049/article/details/73801122</a><br><a target="_blank" rel="noopener" href="https://blog.csdn.net/yangshangwei/article/details/78539433#withmisfirehandlinginstructiondonothing">https://blog.csdn.net/yangshangwei/article/details/78539433#withmisfirehandlinginstructiondonothing</a><br><a target="_blank" rel="noopener" href="http://blog.btmatthews.com/?p=40#comment-33797">http://blog.btmatthews.com/?p=40#comment-33797</a><br><a target="_blank" rel="noopener" href="https://www.baeldung.com/spring-quartz-schedule">https://www.baeldung.com/spring-quartz-schedule</a></p>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/spring-boot/" rel="tag"># spring-boot</a>
              <a href="/tags/%E5%AE%9A%E6%97%B6%E8%B0%83%E5%BA%A6%E5%99%A8/" rel="tag"># 定时调度器</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2019/05/06/spring-boot%E5%90%AF%E5%8A%A8%E6%B5%81%E7%A8%8B/" rel="prev" title="spring-boot启动流程">
                  <i class="fa fa-chevron-left"></i> spring-boot启动流程
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2019/05/06/%E8%87%AA%E5%AE%9A%E4%B9%89spring-boot-starter/" rel="next" title="自定义spring-boot-starter">
                  自定义spring-boot-starter <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>







<script>
  window.addEventListener('tabs:register', () => {
    let { activeClass } = CONFIG.comments;
    if (CONFIG.comments.storage) {
      activeClass = localStorage.getItem('comments_active') || activeClass;
    }
    if (activeClass) {
      const activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
      if (activeTab) {
        activeTab.click();
      }
    }
  });
  if (CONFIG.comments.storage) {
    window.addEventListener('tabs:click', event => {
      if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
      const commentClass = event.target.classList[1];
      localStorage.setItem('comments_active', commentClass);
    });
  }
</script>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2022</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">一年春又来</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/mist/" class="theme-link" rel="noopener" target="_blank">NexT.Mist</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>
<script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script>

  
<script src="/js/local-search.js"></script>






  





</body>
</html>
